Run custom plugin from context menu

Hi all,

I have to migrate an eclipse plugin to a intelliJ plugin

This custom plugin must trigger preconfigured maven commands.

My question is about the contextual menu : the different commands should be available by right clicking on evey pom.xml files from project

Screenshot below (eclipse version)

Can you give me hints on what to do to bind the plugin commands to the context menu only for pom.xml files , since I am pretty new to IntelliJ ?

Regards



1 comment
Comment actions Permalink

You can make action (or action group) invisible depending on context.

 

http://www.jetbrains.org/intellij/sdk/docs/basics/action_system.html

http://www.jetbrains.org/intellij/sdk/docs/tutorials/action_system/working_with_custom_actions.html

http://www.jetbrains.org/intellij/sdk/docs/tutorials/action_system/grouping_action.html

 

public void update(AnActionEvent e) {
VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE);
boolean visible = file != null && file.getName().equals("pom.xml");
e.getPresentation().setEnabledAndVisible(visible);
}
1

Please sign in to leave a comment.