1. Action
extends AnAction class and override actionPerformed method
构造函数中初始化Action显示内容
super("Action Name");
通过参数e获取当前事件的所需内容
如:
Project project = e.getProject(); VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); String filePath = file.getPath();
Action注册:
将自定义按钮添加至现有组别中或者新建组别
<actions> <!-- Add your actions here --> <!-- <action id="generateinnerbuilder" class="HelloAction" text="mytest"--> <!-- description="Plugin Description">--> <!-- <add-to-group group-id="CutCopyPasteGroup" anchor="last"/>--> <!-- </action>--> </actions>
如果需要新建Group,可以添加Group标签:
<!-- <group id="" text="" description="This is the XXX group">--> <!-- <add-to-group group-id="MainMenu" anchor="last"/>--> <!-- </group>-->