Eclipse plugins: how to add a group to the popup context menu?

I have a command available in the eclipse context menu when I right-click on a project folder. The submenu is visible in what I consider the โ€œadd-onsโ€ section of the context menu. However, I want the line separator to distinguish my input from other add-ons. How can i do this? I know that with the help of contributions you can use menuBarPath (I think) to create a group and add actions to it, but how to do this using the menuContribution tag in plugin.xml?

<extension point="org.eclipse.ui.menus">
  <menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
        <menu label="PopKit">
            <command
                commandId="convertToAppKitProjectCommand"
                mnemonic="S"
                id="ie.ondevice.popkit.plugin.menus.popup.convertProjectCommand">
                <visibleWhen>
                   <with variable="activeMenuSelection">
                      <iterate>
                         <adapt type="org.eclipse.core.resources.IProject"/>
                      </iterate>
                   </with>
                </visibleWhen>                  
            </command>
        </menu>
  </menuContribution> 

+3
source share
1 answer

Add a separator to your menu as a contribution:

<menuContribution locationURI="popup:org.eclipse.ui.popup.any?after=additions">
    <menu label="PopKit">
       <separator
             name="some.id.here.">
       </separator>
       <command
             commandId="convertToAppKitProjectCommand"

       // the rest ...
+3

Source: https://habr.com/ru/post/1725954/


All Articles