01 - 插件配置文件 - plugin.xml

目录

一. 官方文档地址

二. 常用项英文版

三. 常用项中文版


一. 官方文档地址

Plugin Configuration File | IntelliJ Platform Plugin SDK

二. 常用项英文版

<!-- `url` specifies the URL of the plugin homepage (can be opened from "Plugins" settings dialog) -->
<idea-plugin url="https://www.jetbrains.com/idea">

  <!-- Plugin name. It should be short and descriptive and in Title Case. 
       Displayed in the "Plugins" settings dialog and the plugin repository Web interface. -->
  <name>Vss Integration</name>

  <!-- Unique identifier of the plugin. Should be FQN.
       Cannot be changed between the plugin versions.
       If not specified, <name> will be used (not recommended). -->
  <id>com.jetbrains.vssintegration</id>

  <!-- Description of the plugin. 
       Should be short and to the point.
       Start the description with a verb in present simple form such as 
       "integrates", "synchronizes", "adds support for" or "lets you view".
       Don’t use marketing adjectives like “simple”, “lightweight”, or “professional”.
       Don’t repeat the name of the plugin.
       For plugins that add language/platform/framework support, the description MUST specify 
       the version of the corresponding language/platform/framework.
       Don't mention the IDE compatibility. E.g. don't say "Adds support to IntelliJ IDEA for..."
       Displayed in the "Plugins" settings dialog and the plugin repository Web interface. 
       Simple HTML elements can be included between <![CDATA[  ]]> tags.  -->
  <description>Integrates Volume Snapshot Service W10</description>

  <!-- Description of changes in the latest version of the plugin.
       Displayed in the "Plugins" settings dialog and the plugin repository Web interface.
       Simple HTML elements can be included between <![CDATA[  ]]> tags.  -->
  <change-notes>Initial release of the plugin.</change-notes>

  <!-- Plugin version
       Recommended format is BRANCH.BUILD.FIX (MAJOR.MINOR.FIX)
       Displayed in the "Plugins" settings dialog and the plugin repository Web interface.  -->
  <version>1.0.0</version>

  <!-- The vendor of the plugin.
       The optional "url" attribute specifies the URL of the vendor homepage.
       The optional "email" attribute specifies the e-mail address of the vendor.
       Displayed in the "Plugins" settings dialog and the plugin repository Web interface. -->
  <vendor url="https://www.company.com" email="support@company.com">A Company Inc.</vendor>

  <!-- Mandatory dependencies on plugins or modules.
       The FQN module names in <depends> elements are used to determine IDE compatibility for the plugin.
       Include at least the module shown below to indicate compatibility with IntelliJ Platform-based products.
       Also include dependencies on other plugins as needed.
       See "Compatibility with Multiple Products" and "Plugin Dependencies" for more information.  -->
  <depends>com.intellij.modules.platform</depends>
  <depends>com.third.party.plugin</depends>

  <!-- Optional dependency on another plugin.
       If the plugin with the "com.MySecondPlugin" ID is installed, the contents of mysecondplugin.xml
       (the format of this file conforms to the format of plugin.xml) will be loaded. -->
  <depends optional="true" config-file="mysecondplugin.xml">com.MySecondPlugin</depends>

  <!-- Minimum and maximum build of IDE compatible with the plugin -->
  <idea-version since-build="183" until-build="183.*"/>

  <!-- Resource bundle (/messages/MyPluginBundle.properties) to be used
       with `key` attributes in extension points and implicit keys like
       `action.[ActionID].text` -->
  <resource-bundle>messages.MyPluginBundle</resource-bundle>

  <!-- Plugin's application components (note that components are deprecated and should not be used in new plugins) 
       See https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_components.html for migration steps
  -->
  <application-components>
    <component>
      <!-- Component's interface class -->
      <interface-class>com.foo.Component1Interface</interface-class>

      <!-- Component's implementation class -->
      <implementation-class>com.foo.impl.Component1Impl</implementation-class>
    </component>
  </application-components>

  <!-- Plugin's project components (note that components are deprecated and should not be used in new plugins) 
       See https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_components.html for migration steps
  -->
  <project-components>
    <component>
      <!-- Interface and implementation classes are the same -->
      <implementation-class>com.foo.Component2</implementation-class>

      <!-- If the "workspace" option is set "true", the component
           saves its state to the .iws file instead of the .ipr file.
           Note that the <option> element is used only if the component
           implements the JDOMExternalizable interface. Otherwise, the
           use of the <option> element takes no effect.  -->
      <option name="workspace" value="true" />

      <!-- If the "loadForDefaultProject" tag is present, the project component is instantiated also for the default project. -->
      <loadForDefaultProject/>
    </component>
  </project-components>

  <!-- Plugin's module components (note that components are deprecated and should not be used in new plugins)  
       See https://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_components.html for migration steps
  -->
  <module-components>
    <component>
      <implementation-class>com.foo.Component3</implementation-class>
    </component>
  </module-components>

  <!-- Actions -->
  <actions>
    <action id="VssIntegration.GarbageCollection" class="com.foo.impl.CollectGarbage" text="Collect _Garbage" description="Run garbage collector">
      <keyboard-shortcut first-keystroke="control alt G" second-keystroke="C" keymap="$default"/>
    </action>
  </actions>

  <!-- Extension points defined by the plugin.
       Extension points are registered by a plugin so that other
       plugins can provide this plugin with certain data. 
  -->
  <extensionPoints>
    <extensionPoint name="testExtensionPoint" beanClass="com.foo.impl.MyExtensionBean"/>
  </extensionPoints>

  <!-- Extensions which the plugin adds to extension points
       defined by the IntelliJ Platform or by other plugins.
       The "defaultExtensionNs " attribute must be set to the
       ID of the plugin defining the extension point, or to 
       "com.intellij" if the extension point is defined by the
       IntelliJ Platform. The name of the tag within the <extensions>
       tag matches the name of the extension point, and the
       "implementation" class specifies the name of the class
       added to the extension point. -->
  <extensions defaultExtensionNs="VssIntegration">
    <testExtensionPoint implementation="com.foo.impl.MyExtensionImpl"/>
  </extensions>
  
  <!-- Application-level listeners -->
  <applicationListeners>
    <listener class="com.foo.impl.MyListener" topic="com.intellij.openapi.vfs.newvfs.BulkFileListener"/>
  </applicationListeners>

  <!-- Project-level listeners -->
  <projectListeners>
    <listener class="com.foo.impl.MyToolwindowListener" topic="com.intellij.openapi.wm.ex.ToolWindowManagerListener"/>
  </projectListeners>
</idea-plugin>

三. 常用项中文版

<idea-plugin>

    <!-- 插件名称,别人在官方插件库搜索你的插件时使用的名称 -->
    <name>MyPlugin</name>

    <!-- 插件唯一id,不能和其他插件项目重复,所以推荐使用com.xxx.xxx的格式
         插件不同版本之间不能更改,若没有指定,则与插件名称相同 -->
    <id>com.example.plugin.myplugin</id>

    <!-- 插件的描述 -->
    <description>my plugin description</description>

    <!-- 插件版本变更信息,支持HTML标签;
         将展示在 settings | Plugins 对话框和插件仓库的Web页面 -->
    <change-notes>Initial release of the plugin.</change-notes>

    <!-- 插件版本 -->
    <version>1.0</version>

    <!-- 供应商主页和email-->
    <vendor url="http://www.jetbrains.com" email="support@jetbrains.com"/>

    <!-- 插件所依赖的其他插件的id -->
    <depends>MyFirstPlugin</depends>

    <!-- 插件兼容IDEA的最大和最小 build 号,两个属性可以任选一个或者同时使用
         官网详细介绍:http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html-->
    <idea-version since-build="3000" until-build="3999"/>

    <!-- application components -->
    <application-components>
        <component>
            <!-- 组件接口 -->
            <interface-class>com.foo.Component1Interface</interface-class>
            <!-- 组件的实现类 -->
            <implementation-class>com.foo.impl.Component1Impl</implementation-class>
        </component>
    </application-components>

    <!-- project components -->
    <project-components>
        <component>
            <!-- 接口和实现类相同 -->
            <interface-class>com.foo.Component2</interface-class>
        </component>
    </project-components>

    <!-- module components -->
    <module-components>
        <component>
            <interface-class>com.foo.Component3</interface-class>
        </component>
    </module-components>

    <!-- Actions -->
    <actions>
        <!-- 功能Action注册 -->
        <action id="translator" class="com.codermonster.translator.TranslatorAction" description="Translate"
                text="Translate">
            <!-- 绑定快捷键,此处也可以选择不绑定 -->
            <keyboard-shortcut first-keystroke="control shift 9" keymap="$default"/>
            <!-- 添加到鼠标右键菜单中 -->
            <add-to-group group-id="EditorPopupMenu" anchor="first"/>
        </action>
    </actions>
    <!-- 插件定义的扩展点,以供其他插件扩展该插件 -->
    <extensionPoints>
        ...
    </extensionPoints>

    <!-- 声明该插件对IDEA core或其他插件的扩展 -->
    <extensions defaultExtensionNs="com.intellij">
        <!--displayName属性和实现类中的展示名应该保持一致-->
        <!-- 配置界面扩展点 -->
        <applicationConfigurable
                parentId="tools"
                instance="com.codermonster.translator.TranslatorSettingConfiguration"
                id="com.codermonster.translator.TranslatorSettingConfiguration"
                displayName="CoderMonsterTranslator"/>
        <!-- 持久化扩展点-->
        <applicationService serviceImplementation="com.codermonster.translator.TranslatorSetting"></applicationService>
        <!-- 持久化扩展点-->
        <projectService serviceImplementation="com.codermonster.translator.TranslatorCache"></projectService>
        <!-- 侧边栏扩展点-->
        <toolWindow id="CoderTranslator" anchor="right"
                    factoryClass="com.codermonster.translator.TranslatorToolsWindow"/>
    </extensions>
</idea-plugin>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xl1024w

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值