Reputation: 4604
I trying to write a eclipse plugin. The first thing i need is:
I tried with following code:
<extension point="org.eclipse.ui.menus">
<menuContribution allPopups="false" locationURI="menu:new?after=additions">
<command commandId="de.vogella.plugin.jsmodule" label="MCS Module" style="push">
</command>
</menuContribution>
</extension>
It's only appears when i choosing the File->New on menu bar.
I am newbie on this area, the question is how to add the item to where i want? Let's say, i want it to be under the popup menu-> New by right click the java project?
Upvotes: 2
Views: 990
Reputation: 22070
Do not do that using a menu contribution. Instead provide a newWizard implementation to contribute the code for creating some new element. The Eclipse UI will then automatically add that wizard at the right places.
The displayed entries for the sub menu depend on the current perspective (e.g. it makes no sense to have "New Java class" in non Java perspectives). That's why you want to create a newWizardShortcut extension for each perspective, where you want to see that context menu sub menu item.
Upvotes: 2