原文鏈接:
http://www.jetbrains.org/intellij/sdk/docs/basics/plugin_structure/plugin_configuration_file.html
這是一個(gè)示例插件配置文件振惰,它展示和描述了可在plugin.xml
文件中使用的所有元素锌妻。
<!-- url=""指定插件主頁(yè)的鏈接(顯示在歡迎界面和"插件"設(shè)置對(duì)話框)-->
<idea-plugin url="http://www.jetbrains.com/idea">
<!-- 插件名稱 -->
<name>VssIntegration</name>
<!-- 插件的唯一標(biāo)識(shí)符趾牧,不能在不同插件版本之間更改
如果未指定則與<name>相同 -->
<id>VssIntegration</id>
<!-- 插件的描述 -->
<description>Vss integration plugin</description>
<!-- 插件最新版本的更改描述
顯示在"插件"設(shè)置對(duì)話框和插件庫(kù)Web界面 -->
<change-notes>Initial release of the plugin.</change-notes>
<!-- 插件版本 -->
<version>1.0</version>
<!-- 插件的廠商
可選的"url"屬性指定廠商的主頁(yè)鏈接呼巷;
可選的"email"屬性指定廠商的電子郵件地址慷荔;
可選的"logo"屬性指定顯示在歡迎界面插件名稱旁邊
的大小為16x16的圖標(biāo)在插件JAR中的地址 -->
<vendor url="http://www.jetbrains.com" email="support@jetbrains.com" logo="icons/plugin.png">Foo Inc.</vendor>
<!-- 此插件所依賴的插件唯一標(biāo)識(shí)符 -->
<depends>MyFirstPlugin</depends>
<!-- 可選的插件依賴
如果安裝了ID為"MySecondPlugin"的插件,
文件mysecondplugin.xml(格式與plugin.xml文件相同)將會(huì)被加載 -->
<depends optional="true" config-file="mysecondplugin.xml">MySecondPlugin</depends>
<!-- 允許插件與系統(tǒng)幫助系統(tǒng)集成(JavaHelp格式)
"file"屬性指定插件目錄下"help"子目錄的JAR文件名
"path"屬性指定JAR文件內(nèi)的helpset文件名 -->
<helpset file="myhelp.jar" path="/Help.hs" />
<!-- 插件與IDEA兼容的最小和最大版本 -->
<idea-version since-build="3000" until-build="3999"/>
<!-- 包含插件描述而柑、操作名稱等文本資源將會(huì)被加載 -->
<resource-bundle>messages.MyPluginBundle</resource-bundle>
<!-- 插件應(yīng)用級(jí)組件 -->
<application-components>
<component>
<!-- 組件接口類 -->
<interface-class>com.foo.Component1Interface</interface-class>
<!-- 組件實(shí)現(xiàn)類 -->
<implementation-class>com.foo.impl.Component1Impl</implementation-class>
</component>
</application-components>
<!-- 插件項(xiàng)目級(jí)組件 -->
<project-components>
<component>
<!-- 接口和實(shí)現(xiàn)類相同 -->
<interface-class>com.foo.Component2</interface-class>
<!-- 如果"workspace"選項(xiàng)設(shè)置為"true"蛤育,組件會(huì)將其狀態(tài)保存到.iws文件而不是.ipr文件
注意<option>元素盡在組件實(shí)現(xiàn)了JDOMExternalizable接口時(shí)有效 -->
<option name="workspace" value="true" />
<!-- 如果存在"loadForDefaultProject"標(biāo)簽,項(xiàng)目級(jí)組件還會(huì)為默認(rèn)項(xiàng)目實(shí)例化 -->
<loadForDefaultProject>
</component>
</project-components>
<!-- 插件模塊級(jí)組件 -->
<module-components>
<component>
<interface-class>com.foo.Component3</interface-class>
</component>
</module-components>
<!-- 操作 -->
<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>
<!-- 插件定義的擴(kuò)展點(diǎn)
擴(kuò)展點(diǎn)由插件注冊(cè)扶檐,以便其他插件可以為此插件提供某些數(shù)據(jù)
“beanClass”屬性指定可以用于擴(kuò)展點(diǎn)的實(shí)現(xiàn)類 -->
<extensionPoints>
<extensionPoint name="testExtensionPoint" beanClass="com.foo.impl.MyExtensionBean"/>
</extensionPoints>
<!-- 插件為IDEA核心或其它插件定義的擴(kuò)展點(diǎn)添加的擴(kuò)展
"defaultExtensionNs "屬性必須設(shè)置為定義擴(kuò)展點(diǎn)插件的ID凶杖,
如果擴(kuò)展點(diǎn)時(shí)IDEA核心定義的,則設(shè)置為"com.intellij" 款筑;
<extensions>標(biāo)簽內(nèi)的標(biāo)簽名稱必須與擴(kuò)展點(diǎn)的名稱匹配智蝠,
"implementation"屬性指定添加到擴(kuò)展點(diǎn)的類名 -->
<extensions xmlns="VssIntegration">
<testExtensionPoint implementation="com.foo.impl.MyExtensionImpl"/>
</extensions>
</idea-plugin>