Andrid Studio插件開發(fā)

http://blog.csdn.net/lmj623565791/article/details/51548272

使用IntelliJ IDEA開發(fā)

一、新建工程,選擇[Intellij Platform Plugin]

二、配置并編寫AnAction類

  1. 在創(chuàng)建向?qū)е信渲貌寮畔⒑涂旖萱I等

    • ActionID:代表該Action的唯一的ID,一般的格式為:pluginName.ID
    • ClassName:類名
    • Name:就是最終插件在菜單上的名稱
    • Description:對(duì)這個(gè)Action的描述信息
  1. 可以在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>
    
  2. 編寫具體實(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的界面

四、部署插件

  1. 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>
    
  2. 輸出jar包

更多

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容