When I right click on a file in the tree, i want to have a new item there (under 'New'). And i want to control when this item/action is it visible or not. How can i do this? (In a plugin) Thank you!
Override method AnAction.update() and call AnActionEvent.getPresentation().setEnabled(), setVisible() or both. There are millions of examples in IntelliJ IDEA Community Edition source code.
Please see http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Action+System
Enabling/Visibility of actions can be controlled via com.intellij.openapi.actionSystem.Presentation
Override method AnAction.update() and call AnActionEvent.getPresentation().setEnabled(), setVisible() or both. There are millions of examples in IntelliJ IDEA Community Edition source code.
BTW there's a dedicated forum for plugin developers: http://devnet.jetbrains.com/community/idea/open_api_and_plugin_development