For a custom IntelliJ plugin I am trying to write a handler that is invoked when the user uses the "cmd" key (or "control" in windows) and clicks in the value of an XML tag (which usually triggers a "go to declaration" or "show usages") in regular java code. In the tutorials I have found samples for creating a plugin that handles a click to an entry in the menu bar, but I need a handler for that one specific action.
Does IntelliJ support handling that event and execute a custom action? Thank you for your help in advance.
Related
I'm using "Netbeans platform 8.1" to develop a rich client application.
It has default menus and actions inside it. I want to hide "Menu/Tools/Plugins" and open the Plugin Window programmatically from my code.
My question is: if I hide the menu from "layer.xml" and change its name to "Plugin_hidden", how can I open that window programmatically?
Use the following code.
Action action = FileUtil.getConfigObject("Actions/System/org-netbeans-modules-autoupdate-ui-actions-PluginManagerAction.instance", Action.class);
action.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, ""));
I determined the path for the action by expanding Important Files/XML Layer/<this layer in context>/Menu Bar/Tools under my project in the Projects window and double clicking on Plugins. This will open a generated layer XML that contains the Plugin manager action. From there you can figure out what the action path is.
If you don't have an XML Layer in important files, you can add an empty one using the New File wizard. Just select Module Development/XML Layer. An XML layer isn't required for the above code to work; it just makes it possible to browse the available actions so that you can determine the path for the action.
For more information see DevFaqInvokeActionProgrammatically
If I use eclipse and right click on a part of Java source code, the context menu depends on the syntactic element the user clicks on (like: a method, a variable,...).
How can I implement this kind of behaviour in my own eclipse plugin, e.g. add an item to the context menu only if the user clicks on a method in Java source code. Furthermore, the plugin needs to know which method the user clicks on.
I guess I have to relate the clicking position to the abstract syntax tree that eclipse builds but I have no idea how to do that.
You do this with Eclipse Commands and you can enable them and change their visibility in many ways, depending on selection, global state, etc.
I guess I have to relate the clicking position to the abstract syntax
tree that eclipse builds but I have no idea how to do that.
The good news is you (generally) don't have to do that, Eclipse has done all that heavy lifting for you.
It is quite a broad subject, so I suggest working through some tutorials on Commands first:
Adding menus, toolbar and popup menus to the Eclipse IDE - Tutorial
Eclipse Commands Advanced - Tutorial
I am using the Force.com plugin to facilitate coding Salesforce classes (java-like language). When I right click in the text editor I get Force.com > Save to Server menu entry.
How do I assign a keyboard shortcut to this action?
I attempted to leverage Eclipe's macro plugin PracticallyMacro but it did not record right clicks.
Instead I came up with a solution using:
'TinyTask' can export record and save as small 'exe' files which can then be added as external Eclipse builders
'TyperTask' can automate tasks based on typed characters - epic.
I have a wizard, in which many of the panels provide forms, with their respective validtors. If I click on the cancel button within the wizard, I am unable to run the onCancel logic without the forms being validated. [The only job that the cancel button will be doing is redirection] Is there a way to disable the validation just for that situation?
I am using Apache Wicket 6.10, and the Wizard control is coming from Wicket-Extensions 6.10.
You should set Button.setDefaultFormProcessing(false) to skip validation.
Also take a look at this link for an example: https://cwiki.apache.org/confluence/display/WICKET/Multiple+submit+buttons
My colleagues and I are building a new RCP application and trying to find our footing in RCP. My coworker managed to get the Eclipse Help framework working pretty quickly - but he used the old style Actions and ActionBarAdvisor.makeActions() to do it. All of the RCP Menu creation tutorials I've read (the ones that were written post Eclipse 3.3 anyway) advocate depreciating Actions and switching over completely to Commands. So I'm trying to do this. However, I cannot get the help Commands to work - not without using the help actions.
Specifically, I'm attempting to figure out how to add the default Eclipse help menu commands org.eclipse.ui.help.helpContents and org.eclipse.ui.help.helpSearch to my help menu. I've created the menu contribution, and added the commands. But they remain greyed out. I can't find any mention of anything else I have to do to hook them up to the help framework my coworker had working before using actions. If I add the actions for them and register them in make Action, they still work. But I'm trying to do this without Actions. How is this done? What am I not doing?
According to the Command tutorial on vogella.de some common commands need some ActionFactories registered:
Standard commands sometimes map to actions which are contributed via ActionFactory in the class ApplicationActionBarAdvisor. If the ActionFactory returns an IAction you need to register this action. If not these commands are inactive in your menu. For example the following made the reset perspective and welcome command active.
I think, this might be the case with the Help command as well - but I have not tested it. The other possibility would be that there is no enabled handler for the command...