This simple tutorial shows you how to create an Action Item in the Project View Popup Menu.
When you right click on the project view you will have this action item in the popup menu. You can extend or use this to execute any action.
Following are the two files you should work with.
Following are the GitHub URL's for complete plugin project. You can clone the project or downolad the project as a zip file. To run the project open IntelliJ IDEA and import the project.
GitHub repository URL - https://github.com/lakjcomspace/IntelliJProjectViewMenuAction
GitHub HTTPS clone URL - https://github.com/lakjcomspace/IntelliJProjectViewMenuAction.git
Download Project as a Zip - https://github.com/lakjcomspace/IntelliJProjectViewMenuAction/archive/master.zip
When you right click on the project view you will have this action item in the popup menu. You can extend or use this to execute any action.
Following are the two files you should work with.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<idea-plugin version="2"> | |
<id>com.lakj.comspace.intellij.projectviewmenuaction</id> | |
<name>Lak J Prject View Menu Action</name> | |
<version>1.0</version> | |
<vendor email="" url="http://lakjeewa.blogspot.com/">Lak J Comspace</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> | |
<!-- please see http://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description --> | |
<idea-version since-build="131"/> | |
<!-- please see http://confluence.jetbrains.com/display/IDEADEV/Plugin+Compatibility+with+IntelliJ+Platform+Products | |
on how to target different products --> | |
<!-- uncomment to enable plugin in all products | |
<depends>com.intellij.modules.lang</depends> | |
--> | |
<extensions defaultExtensionNs="com.intellij"> | |
<!-- Add your extensions here --> | |
</extensions> | |
<application-components> | |
<!-- Add your application components here --> | |
</application-components> | |
<project-components> | |
<!-- Add your project components here --> | |
</project-components> | |
<actions> | |
<group id="lakj.comspace"> | |
<action | |
id="lakj.comspace.projectviewmenuaction" | |
class="com.lakj.comspace.intellij.projectviewmenuaction.ProjectViewAction" | |
text="Lak J Project View Menu Action" | |
description="Lak J Compspace Project View Menu Popup Action." | |
icon="/com/lakj/comspace/intellij/projectviewmenuaction/resources/icon/icon.png"/> | |
<add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="AnalyzeMenu"/> | |
</group> | |
</actions> | |
</idea-plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lakj.comspace.intellij.projectviewmenuaction; | |
import com.intellij.openapi.actionSystem.AnAction; | |
import com.intellij.openapi.actionSystem.AnActionEvent; | |
import com.intellij.openapi.project.Project; | |
import com.intellij.openapi.ui.Messages; | |
/** | |
* Created by Lak J Comspace on 1/25/2015. | |
*/ | |
public class ProjectViewAction extends AnAction { | |
/** | |
* Implement this method to provide your action handler. | |
* | |
* @param e Carries information on the invocation place | |
*/ | |
@Override | |
public void actionPerformed(AnActionEvent e) { | |
Project project = e.getProject(); | |
Messages.showMessageDialog(project, "Hello, You just clicked the IntelliJ project view popup menu action item.", | |
"Project View Action", Messages.getInformationIcon()); | |
} | |
} |
GitHub repository URL - https://github.com/lakjcomspace/IntelliJProjectViewMenuAction
GitHub HTTPS clone URL - https://github.com/lakjcomspace/IntelliJProjectViewMenuAction.git
Download Project as a Zip - https://github.com/lakjcomspace/IntelliJProjectViewMenuAction/archive/master.zip
No comments:
Post a Comment