Is it possible to extend Eclipse Search Menu

前端 未结 3 1252
庸人自扰
庸人自扰 2021-01-13 13:14

right now in eclipse it is not possible to extend Menu defined by Other plugins by using eclipse extension: org.eclipse.ui.menus.

I want to add one menu item in Sear

相关标签:
3条回答
  • 2021-01-13 13:35

    Update August 2012, as commented by reprogrammer, org.eclipse.ui.actionSets is deprecated:

    Instead, use the extension point org.eclipse.ui.commands.


    Original answer (August 2011)

    The actionSet (extension point="org.eclipse.ui.actionSets") with an action on 'menubarPath="org.eclipse.search.menu/dialogGroup"' recommended by Manuel Selva is the official solution, in line with general menu contribution.

    But beware of some issue that might still lingering for Search menu contribution, as illustrated by this thread around the (supposedly fixed) bug 15684:
    (it was in 2009, hopefully the issue has been addressed since)

    What actually does work is redefining the whole Search Menu as in the workaround that is still currently used in JDT 3.6:

       <extension
             point="org.eclipse.ui.actionSets">
          <actionSet
                label="%JavaSearchActionSet.label"
                description="%JavaSearchActionSet.description"
                visible="false"
                id="org.eclipse.jdt.ui.SearchActionSet">
    <!-- see http://bugs.eclipse.org/bugs/show_bug.cgi?id=15684    -->
    <!-- Note: The menu (re-) definition has to be here due to bug: -->
    <!-- =================================================================== -->
    <!-- Search Menu                                                         -->
    <!-- =================================================================== -->
             <menu
                   label="%searchMenu.label"
                   path="navigate"
                   id="org.eclipse.search.menu">
                    <groupMarker name="internalDialogGroup"/>   <!-- not to be used by clients  -->
                    <groupMarker name="dialogGroup"/>           <!-- to be used by clients      -->
                    <separator name="fileSearchContextMenuActionsGroup"/> <!-- to be used by clients      -->
                    <separator name="contextMenuActionsGroup"/> <!-- to be used by clients -->
                    <separator name="occurencesActionsGroup"/> <!-- to be used by clients -->
                    <separator name="extraSearchGroup"/> <!-- to be used by clients -->
             </menu>
    <!-- (...) -->
    
    0 讨论(0)
  • 2021-01-13 13:38

    You can extend menus from other plugins using org.eclipse.ui.actionSets extension point

    This is how the JDT does to extend the search menu with its own action. In order to have the action in a given menu you'll have to fill the menubarPath value. For example the JDT for the Java search action filled it with:

    org.eclipse.search.menu/dialogGroup
    

    I suggest to import the JDT UI sources and to look at the JDT plugin.xml file. FOr that you will need a classic Eclipse SDK and then in the plugins view right click on the org.eclipse.jdt.ui plugin and select import as source.

    0 讨论(0)
  • 2021-01-13 13:47

    As long as you know the ID of the menu or toolbar, you can extend these using the org.eclipse.ui.menus extension point. For the search menu, this ID is org.eclipse.search.menu. If you want to add stuff to the dialogGroup then use org.eclipse.search.menu?after=dialogGroup.

    0 讨论(0)
提交回复
热议问题