以往在eclipse上面开发插件,有兴致想尝试Idea上玩一下插件开发。
记录在idea上面第一个插件hello world
1、点击File->New->Project… 选择IntelliJ Platform Plugin
2、点击下一步后,输入Project Name,然后点击完成
3、新建Action
package com.action;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.Messages;
import org.jetbrains.annotations.NotNull;
/**
* @author twilight
* @since V1.0
*/
public class HelloWorldAction extends AnAction {
@Override
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
Messages.showMessageDialog("Hello,World","这是一个idea plugin",Messages.getInformationIcon());
}
}
4、修改plugin.xml
<actions>
<!-- Add your actions here -->
<action class="com.action.HelloWorldAction" text="HelloPluin" id="MyhellWorld" description="dddd" >
<add-to-group group-id="ToolsMenu" anchor="first"></add-to-group>
</action>
</actions>
5、运行插件