http://blog.csdn.net/lmj623565791/article/details/51548272
使用IntelliJ IDEA開發(fā)
一、新建工程,選擇[Intellij Platform Plugin]
二、配置并編寫AnAction類
-
在創(chuàng)建向?qū)е信渲貌寮畔⒑涂旖萱I等
-
ActionID:代表該Action的唯一的ID,一般的格式為:pluginName.ID -
ClassName:類名 -
Name:就是最終插件在菜單上的名稱 -
Description:對(duì)這個(gè)Action的描述信息
-
-
可以在plugin.xml中查看或跟新配置信息
<actions> <action id="TestTranslation.TranslateAction" class="com.ccy.TranslateAction" text="Translate" description="translate for selected word"> <add-to-group group-id="EditMenu" anchor="first"/> <keyboard-shortcut keymap="$default" first-keystroke="meta I"/> </action> </actions> -
編寫具體實(shí)現(xiàn)
public class MyAction extends AnAction { // 點(diǎn)擊菜單時(shí)觸發(fā) @Override public void actionPerformed(AnActionEvent e) { Messages.showMessageDialog( "Hello World!", "Information", Messages.getInformationIcon()); } }
三、測試運(yùn)行
點(diǎn)擊[Run],默認(rèn)啟動(dòng)一個(gè)新的IntelliJ IDEA的界面
四、部署插件
-
在
plugin.xml中填寫信息<id>com.your.company.unique.plugin.id</id> <name>Plugin display name here</name> <version>1.0</version> <vendor email="support@yourcompany.com" url="http://www.yourcompany.com">YourCompany</vendor> <description> <![CDATA[ Enter short description for your plugin here.<br> <em>most HTML tags may be used</em> ]]> </description> <change-notes> <![CDATA[ Add change notes here.<br> <em>most HTML tags may be used</em> ]]> </change-notes> -
輸出jar包
- 點(diǎn)擊build->prepare plugin…
- 打開Andorid Studio,選擇Preferences -> Plugins -> Install plugin from disk
- 發(fā)布到倉庫http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/publishing_plugin.html