I'm building a plugin, and adding an entry to the context menu (right-click on a folder in the project tree).
So far it works, following this tutorial:
http://www.eclipse.org/articles/article.php?file=Article-JFaceWizards/index.html
The problem is that it's adding my entry in the root of the context menu. Since my entry refers to a "New XXX" wizard, I want it to go to the "New" submenu.
It seems like I would have to set the correct locationURI or menuPath in my plugin.xml. However I can't find the locationURI or menuPath corresponding to that submenu. How can I find that?
The new contributions are menu ID based, not menu path based. So it should be something like:
<menuContribution
locationURI="menu:file?after=additions" />
See this SO answer for an example of locationUri.
See Menu Extension for more. The exact id is either:
found in the existing plugin.xml from the menu or
determined with plugin Spy
See "How to add items in popup menu?" (from justinmreina) for more on adding an entry to a menu.
If you've created a plugin for a 'New XXX' wizard, you can add it inside the 'New' menu that you see when you right-click inside the Navigator by customizing the perspective.
Go to Window -> Customize Perspective and click on the Shortcuts tab. You should see 'New XXX'. Select it and you're good to go.
Related
I looked at the MS docs on the VS menu list, and I can't find which menu ID to use. What I want to do is write a VSIX extension that gives me a menu pick when I right click on an Error message, and it will be able to obtain the contents of the selected error message.
Does anyone know if there is a way to customize that contextual menu?
Pick a menu command like "Previous Error" from the context menu, search the various .vsct files under "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK\VisualStudioIntegration\Common\Inc", and you should get a hit in the ShellCmdDef.vsct file.
<Button Condition="!Defined(VSE)" guid="CLSID_VsTaskListPackage" id="cmdidErrorListPrevError" priority="0x0000" type="Button">
<CommandFlag>AllowClientRole</CommandFlag>
<CommandFlag>DefaultDisabled</CommandFlag>
<CommandFlag>CommandWellOnly</CommandFlag>
<Strings>
<ButtonText>P&revious Error</ButtonText>
<CommandName>Previous Error</CommandName>
</Strings>
</Button>
Now you know the ID of the command (cmdidErrorListPrevError), so you can search for that, to find where/how it's placed.
You should get a hit in the ShellCmdPlace.vsct:
<CommandPlacement guid="CLSID_VsTaskListPackage" id="cmdidErrorListPrevError" priority="0x0200">
<Parent guid="guidSHLMainMenu" id="IDG_VS_ERRORLIST_NEXTPREV_ERR"/>
</CommandPlacement>
Now search on that ID to find the menu that groupID is parented to, which will also take us to ShellCmdPlace.vsct and you can identify the actual context menu:
<Group guid="guidSHLMainMenu" id="IDG_VS_ERRORLIST_NEXTPREV_ERR" priority="0x0400">
<Parent guid="guidSHLMainMenu" id="IDM_VS_CTXT_ERRORLIST"/>
</Group>
So now, you should define your own custom menu group parented off the same, with your commands parented to your custom menu group.
Caveat: This doesn't always work as there are a LOT of commands and menus that are not defined in the files included in the VSSDK. But for standard stuff like this, the technique "usually" works :-).
Sincerely,
Currently when i want to select my Custom project, it is has to be selected by NEW->OTHER..->My-Custom-Project.
Is it possible to display my custom project under NEW menu.
NEW->My-Custom-Project.
Assuming you have written a New Wizard for your custom project use the org.eclipse.ui.perspectiveExtensions extension point to add a 'new wizard shortcut' to display the wizard directly on the New menu.
Something like:
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="org.eclipse.ui.resourcePerspective">
<newWizardShortcut id="org.eclipse.jdt.ui.wizards.NewProjectCreationWizard"/>
The shortcut is specific to the perspective.
You may have to do a Perspective Reset (or Customize Perspective) to get the new shortcut to show.
I'm quite confused when it comes to file templates in IntelliJ. Basically, when I right click anything and hover my mouse over to New, I can see the usual file templates like Java Class, HTML File and so on. I downloaded Scala plugin and I can see Scala templates (Scala Class, Scala Object, etc.) if I go to Edit File Templates, but I can't actually use/see them in the New menu. Is there a way to modify what I see in the New menu? I'd like to be able to create Scala classes.
Go to Settings -> Menus and Toolbars
There you will see many type of menus. You need edit the menu you want the files to be displayed. Most Probably "Project View Popup Menu".
Click on "Add After" button on right. There you choose the file form plug-ins or other category to be displayed.
I added "Show Bytecode" to meny well it does not make sense here. You can add files from scala plugin like that.
You can restore to Defaults if you mess up easily by clicking on
"Restore All Defaults" button.
I created some batch work and integrated it as ExternalTool to the IntelliJ IDEA. as described here: Configure Intellij IDEA to run batch file
But how can I add buttons to my toolbar that will activate the batch that defined as external tool?
It is quite easy.
Assuming that you already have an External Tool configured just right click on the menu bar and choose Customize Menus and Toolbars...:
Next step is to mark the last item (whatever that is in your setup) in Main Toolbar and select Add After...:
Now you can select your external tool from the Choose Actions To Add window (here you can also select an icon to use):
Action has been added:
And your button has been added to the toolbar:
When we right click on a tab of an JavaEditor in eclipse, we get three options
1. Close
2. Close Others
3. Close All
I wanted to add an extra menu like this:
1. Close
2. Close Others
3. Close All
4. Open File in Folder
After my own study I was able to locate the command/handler that does these operations in the org.eclipse.ui plugin. But I wasn't able to view the menu contributuion anywhere.
Specifically My questions are:
How can I add the 4th menu option in the popup menu?
In which plugin is the menuContribution that actually displays those 3 menus when I right click on a tab?
I have attached the screenshot of the closeOthers command in te plugin editor..Hope it makes my question clear.
There is a bug about this: Bug 103045. As you can see from the bug's history, it has not been solved, but there seems to be a workaround written there. Good luck.