zaterdag 2 juni 2012

Eclipse base location uri for menus

Since they are impossible to find on the net here is the list of all base location uri's in eclipse that are used in the org.eclipse.ui.menus extension point:


menu:org.eclipse.ui.main.menu // the top-level menu
popup:org.eclipse.ui.popup.any // all pop-up menus
toolbar:org.eclipse.ui.main.toolbar // the top-level tool bar
toolbar:org.eclipse.ui.trim.command1 // the top left trim (main toolbar area)
toolbar:org.eclipse.ui.trim.command2 // the top right trim (perspective switcher area)
toolbar:org.eclipse.ui.trim.vertical1 // the left vertical trim
toolbar:org.eclipse.ui.trim.vertical2 // the right vertical trim
toolbar:org.eclipse.ui.trim.status // the status line trim

to access the menu/toolbar/popup of a part (view or editor):

menu:partid //the part's chevron menu

toolbar:partid //the part's toolbar (cannot contain other toolbars)
popup:partid //the part's popup menu (register the context menu in createPartControl first)



6 opmerkingen:

  1. Hi Wim.

    We have upgraded Eclipse to 4.2.1 version. Then we have unfortunatelly seen that toolbar:org.eclipse.ui.main.toolbar has been placed after the Quick Search text field.
    Could i ask you if you have any idea about how to solve it?

    BeantwoordenVerwijderen
  2. Hi there,

    I had the same issue and solved it by using


    cf. WorkbenchWindow.populateTopTrimContributions()

    HTH

    BeantwoordenVerwijderen
  3. Woops native XML is not rendered...
    the menuContribution must have a locationURI="toolbar:org.eclipse.ui.main.toolbar?before=PerspectiveSpacer"

    BeantwoordenVerwijderen
  4. You my sir, have just made my day! I cannot get my head around the eclipse documentation: why are these kinds of things not easily accessible? At the very least I would like to have a pointer to how I could determine the locationURI's. Apparently they are considered either too trivial to list, or too 'simple' too look up. How did you find these URI's?

    BeantwoordenVerwijderen
  5. I too am extremely disappointed in the official Eclipse documentation. Plugin Spy seems useful at first but is misleading! Thank you!

    BeantwoordenVerwijderen
  6. You see all tis constants in org.eclipse.ui.menus.MenuUtil class.

    BeantwoordenVerwijderen