Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Adding a wizard to the new context menu of the package explorer
Adding a wizard to the new context menu of the package explorer [message #523471] Fri, 26 March 2010 14:53 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 2
Registered: March 2010
Junior Member
Hello everybody,

I'm trying to add a wizard to the new context menu of the package explorer via the extension point "org.eclipse.ui.navigator.navigatorContent". The following configuration inside the plugin.xml of my plugin works for the project explorer, but not for the package explorer:

<extension point="org.eclipse.ui.navigator.navigatorContent">
    <commonWizard
        type="new"
        menuGroupId="org.eclipse.jdt.ui.java"
        wizardId="WIZARD_ID_PLACEHOLDER">
        <enablement>
            <instanceof
                value="org.eclipse.jdt.core.IPackageFragment">
            </instanceof>
        </enablement>
    </commonWizard>
</extension>


What am I doing wrong? The wizard shall only be available for package fragments and shall be displayed inside the Java section of the new context menu. Thanks in advance!

Best regards, Robin.
icon3.gif  Re: Adding a wizard to the new context menu of the package explorer [message #523492 is a reply to message #523471] Fri, 26 March 2010 15:34 Go to previous message
Martin D. is currently offline Martin D.Friend
Messages: 5
Registered: March 2010
Location: Germany
Junior Member
Hi Robin,
I had the same problems with the visibleWhen-condition of commands. I found the solution in the book Eclipse plug-ins from Clayberg/Rubel:
<extension
         point="org.eclipse.ui.navigator.navigatorContent">
      <commonWizard
            type="new"
            menuGroupId="org.eclipse.jdt.ui.java"
            wizardId="WIZARD_ID_PLACEHOLDER">
         <enablement>
            <with variable="selection">
               <iterate
                     ifEmpty="false"
                     operator="or">
                  <instanceof
                        value="org.eclipse.jdt.core.IPackageFragment">
                  </instanceof>
               </iterate>
            </with>
         </enablement>
      </commonWizard>
   </extension>

The main aspect to know is how the condition matching works:
You have to test the global variable selection (which returns a collection/iterator of the selected items) and to iterate through them in order to test each one.

In your wizard you then should get the same selection as parameter of the init-method. There you should filter/check it again and take the first object of the type IPackageFragment...

I hope this works for you Smile
Martin
Previous Topic:Responding to specific kinds of interruption in a builder
Next Topic:Dynamic web project option is not showing in File->New->other
Goto Forum:
  


Current Time: Thu Apr 25 16:25:13 GMT 2024

Powered by FUDForum. Page generated in 0.03821 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top