[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Add a cascade menu to a contex menu item

Jörg,

Code like this can be used to add submenus programmatically
  public void menuAboutToShow(IMenuManager menuManager)
  {
    super.menuAboutToShow(menuManager);
    MenuManager submenuManager = null;

    submenuManager = new MenuManager(LibraryEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
    populateManager(submenuManager, createChildActions, null);
    menuManager.insertBefore("edit", submenuManager);

    submenuManager = new MenuManager(LibraryEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
    populateManager(submenuManager, createSiblingActions, null);
    menuManager.insertBefore("edit", submenuManager);
  }

Jörg wrote:
Ah sorry for the bad description. No i meant to a context menu in a jface tableviewer.

Ed Merks schrieb:
Jörg,

You mean declaratively in the plugin.xml?

  <extension point="org.eclipse.ui.popupMenus">
    <objectContribution id="org.eclipse.emf.ecore.editor.Open" objectClass="org.eclipse.core.resources.IFile">
      <visibility>
        <systemProperty name="org.eclipse.emf.ecore.editor.Open" value="true"/>
      </visibility>

      <menu id="org.eclipse.emf.ecore.editor.Open" label="%_UI_OpenAs_menu_item" path="org.eclipse.ui.OpenWithSubMenu">
        <separator name="additions" />
      </menu>

      <action id="org.eclipse.emf.ecore.editor.OpenXMLReflectiveEditorAction" label="%_UI_EMFXML_menu_item" menubarPath="org.eclipse.emf.ecore.editor.Open/additions" class="org.eclipse.emf.ecore.action.OpenEditorAction" enablesFor="1">
      </action>

      <action id="org.eclipse.emf.ecore.editor.OpenReflectiveEditorAction" label="%_UI_EMFXMI_menu_item" menubarPath="org.eclipse.emf.ecore.editor.Open/additions" class="org.eclipse.emf.ecore.action.OpenEditorAction" enablesFor="1">
      </action>
    </objectContribution>

    <objectContribution id="org.eclipse.emf.ecore.editor.CreateDynamicInstance" objectClass="org.eclipse.emf.ecore.EClass">
      <action id="org.eclipse.emf.ecore.editor.CreateDynamicInstanceAction" label="%_UI_CreateDynamicInstance_menu_item" menubarPath="additions" class="org.eclipse.emf.ecore.action.CreateDynamicInstanceAction" enablesFor="1">
      </action>
    </objectContribution>
  </extension>


Jörg wrote:
Hello,

does somebody know, how can i add a cascade menu to a contex menu item?

Greetings