eclipse-pluginwizardpopupmenu

how to add Wizards created in New->File->others into popup menus when right click in project explorer


I have created a category in File->New->Others say "Enterprise".With some Wizards in it lets say "Instance","Component", etc. Now what i want ,when i right click in Project Explorerand go in New those wizards should be seen their itself. Basically trying to make popup menu of those wizards.

So i created popup menus as:

<extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="true"
            locationURI="popup:common.new.menu?before=additions">
         <command
               commandId="CommandComponent"
               label="Component"
               style="push">
         </command>
      </menuContribution>
   </extension>
   <extension
         point="org.eclipse.ui.commands">
      <command
            id="CommandComponent"
            name="Component">
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.handlers">
      <handler
            commandId="CommandComponent">
      </handler>
   </extension>

Now how could I give the same class to the handler which I gave to Wizard Component?

Or do I have to write a new class with the same functionality but as per handler format (if it is possible)?


Solution

  • You use the org.eclipse.ui.perspectiveExtensions extension point to define the New Wizards which are show at the top level of the New menu using the newWizardShortcut element.

    Something like:

    <extension
         point="org.eclipse.ui.perspectiveExtensions">
      <perspectiveExtension
            targetID="org.eclipse.jdt.ui.JavaPerspective">
         <newWizardShortcut
               id="org.eclipse.jdt.junit.wizards.NewTestCaseCreationWizard">
         </newWizardShortcut>
      </perspectiveExtension>
    

    (which is the New JUnit Test Case shortcut).

    You may need to Reset the Perspective or use Customize Perspective to make the item visible as the user has control over which of these shortcuts is shown.

    More info in the help