edit this page - page history - about editing

Eclipse Popup Menu Subtrees

Eclipse

If you want popup menu items to appear in the top-level of the menu, just use the ID of the menu contribution itself:

<extension point="org.eclipse.ui.popupMenus">
  <objectContribution
      adaptable="false"
      id="org.openiaml.model.codegen.objectContribution1"
      nameFilter="*.iaml"
      objectClass="org.eclipse.core.resources.IResource">

    <menu
        id="org.openiaml.model.diagram.custom.menu1"
        path="additions"
        label="&amp;IAML Tools">
    </menu>

    <action
        class="org.openiaml.model.diagram.custom.actions.InferEntireModelAction"
        id="org.openiaml.model.diagram.custom.action4"
        label="Infer all elements in-place"
        menubarPath="org.openiaml.model.diagram.custom.menu1">
    </action>
  </objectContribution>
</extension>

If however, you want menu items to appear as a sub-tree of your menu, create a "separator" and use the menuPath attribute as in "ID/group":

...

    <menu
        id="org.openiaml.model.diagram.custom.menu1"
        path="additions"
        label="&amp;IAML Tools">
      <separator name="group1" /> <!-- changed -->
    </menu>

    <action
        class="org.openiaml.model.diagram.custom.actions.InferEntireModelAction"
        id="org.openiaml.model.diagram.custom.action4"
        label="Infer all elements in-place"
        menubarPath="org.openiaml.model.diagram.custom.menu1/group1"> <!-- changed -->
    </action>

Categories: Eclipse | Code Samples
edit this page - what links to here? - page history - top
Last edited by jevon jevon 101 months ago