Add item above "Project" to context menu of eclipse project

I am working on an eclipse based custom IDE for our development environment.
In my new perspective, I have included "Project Explorer" and so that I can add commands to the context menu, but when I include a new wizard (project wizard) in the "new" type, it appears under the "Project Wizard

The CARD file should be above "Project ..."

and I wish he was above him.

"Plugin-in Project" comes before "Project ..."

The plugin.xml file for this snippet is attached

<extension point="org.eclipse.ui.navigator.navigatorContent">
      <commonWizard
              type="new"
              wizardId="dev.xxx.wizard.XXXProject">
              <enablement></enablement>
      </commonWizard>
</extension>

      

It shows up when I access New

from the toolbar or MenuBar (after I added it as a shortcut in the layout, in the IPerspectiveFactory implementation

enter image description here

but for some reason it doesn't show up in the "Project Explorer" section. But its working mode under "Navigator View"

enter image description here

+3


source to share


3 answers


Use an extension point org.eclipse.ui.perspectiveExtensions

to define an entry newWizardShortcut

for your new project master.

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>

      



You may need perspective "reset" to get the selected change.

You can also customize these shortcuts in the Window> Adjust Perspective dialog box on the Shortcuts tab.

-1


source


As mentioned in NewActionProvider.java

no menugroupid to place "My Project Wizard" in the "Project ..." group: (.



/**
 * Adds a submenu to the given menu with the name "group.new" see
 * {@link ICommonMenuConstants#GROUP_NEW}). The submenu contains the following structure:
 * 
 * <ul>
 * <li>a new generic project wizard shortcut action, </li>
 * <li>a separator, </li>
 * <li>a set of context senstive wizard shortcuts (as defined by
 * <b>org.eclipse.ui.navigator.commonWizard</b>), </li>
 * <li>another separator, </li>
 * <li>a generic examples wizard shortcut action, and finally </li>
 * <li>a generic "Other" new wizard shortcut action</li>
 * </ul>
 */

      

The "new" submenu for "Project Explorer" will always be in this format, so I need to make my own implementation to add the project to the project group. Dear Greg thanks you for your time. So I create a NewActionProvider implementation like in https://cvalcarcel.wordpress.com/tag/commonwizard/

0


source


The desired behavior can be obtained by using the standard ResourceNavigator

(org.eclipse.ui.views.ResourceNavigator) instead ProjectExplorer

.

In this case, the new wizards will be automatically split in the project and non-project wizards if the former are automatically added to the same group as the wizard Project...

(they are actually added above it regardless of what is menuGroupId

installed).

So, if you want to properly implement the behavior in question, you need to either use a view Navigator

or extend it.

(I know the question was asked specifically about ProjectExplorer

, but nonetheless, I think my answer could be used for someone with a similar problem)

0


source







All Articles