0

I have a new context menu entry "Compare..." and the sub-menus are some tools configured in the preferences (for example "Beyond Compare") that is used to compare some custom files in my Project Explorer view and the context menu entry will only be visible on certain file selections in the tree structure in Project Explorer view and here's the plugin.xml file content of this context menu entry -

extension
         point="org.eclipse.ui.menus">
       <menuContribution
             allPopups="true"
             locationURI="popup:org.eclipse.ui.popup.any?after=additions">
          <menu
                id="compareMenu"
                label="Compare..."
                tooltip="Compare the selected with other file">
             <separator
                   name="compareGroup"
                   visible="false">
             </separator>
          </menu>
       </menuContribution>
</extension>

And in the "Properties" view we have various tabs configured the following way -

<extension
          point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
       <propertyTabs
             contributorId="org.eclipse.ui.navigator.ProjectExplorer">
          <propertyTab
                afterTab="CommonNavigator.tab.Resource"
                category="resource"
                id="com.ui.revisionInfoTab"
                label="Revision Info">
          </propertyTab>
          <propertyTab
                afterTab="com.ui.revisionInfoTab"
                category="resource"
                id="com.ui.revisionChangesTab"
                label="Revision Changes">
          </propertyTab>
          <propertyTab
                afterTab="com.ui.revisionChangesTab"
                category="resource"
                id="com.ui.allByParameterTab"
                label="All by Parameter">
          </propertyTab>
          <propertyTab
                afterTab="com.ui.allByParameterTab"
                category="resource"
                id="com.ui.allByRevisionTab"
                label="All by Revision">
          </propertyTab>
       </propertyTabs>
    </extension>

And I want to add the same context menu entry "Compare..." and its dynamic sub-menu entries to all the tabs in the Properties view and they should become visible only upon certain selections in the Properties view

So far, I tried adding the same context menu entry to the Properties view the following way -

<extension
         point="org.eclipse.ui.menus">
       <menuContribution
             allPopups="true"
             locationURI="popup:org.eclipse.ui.popup.any?after=additions">
          <menu
                id="compareMenu"
                label="Compare..."
                tooltip="Compare the selected with other file">
             <separator
                   name="compareGroup"
                   visible="false">
             </separator>
          </menu>
       </menuContribution>
       <menuContribution
             locationURI="menu:org.eclipse.ui.views.PropertySheet">
          <menu
                id="compareMenu"
                label="Compare..."
                tooltip="Compare the selected file with another file">
             <separator
                   name="compareGroup"
                   visible="false">
             </separator>
          </menu>
       </menuContribution>

where I have used the value "menu:org.eclipse.ui.views.PropertySheet" as locationURI for the Properties View but this does not seem to work since I don't see the context menu entry, is this the correct way? Should the <menuContribution locationURI be duplicated in the plugin.xml file for various views and is the locationURI I have used correct? Also, how do I make sure the context menu entry will only be visible upon certain selections in the Properties view? I could not find much information for my scenario after a fair bit of research trying to find Eclipse articles, could you please guide me in the right direction since I'm very new to Eclipse plugin development?

6
  • Could some experts please guide me in the right direction? I'm new to Eclipse plugin development, are there any articles around the issue that I'm facing or in general about customizing context menu entries in the Properties view? Commented Feb 26 at 7:17
  • Tabbed property views aren't used that much. Looking through the few examples in the bits of Eclipse I have checked out I don't see anything that does anything like this with menus. Commented Feb 26 at 11:13
  • So, isn't it possible to add a new menu entry to the Properties view's already existing menus ("Copy" and "Restore Default Value")? Keeping aside the tabbed property views, isn't it possible at all in general to customize Properties view's menu? Commented Feb 26 at 11:52
  • The org.eclipse.ui.views plugin adds the "New Properties View" item to the menu:org.eclipse.ui.views.PropertySheet menu using menuContribution with a command child. Possibly you want command rather than menu Commented Feb 26 at 13:15
  • Thanks for the hint! Also, I found this article about tabbed property view - eclipse.org/articles/Article-Tabbed-Properties/… but it doesn't say anything about popup menus in the properties view, can you please share any Eclipse articles that also talks about popup menus in the tabbed property view in case you came across any? Commented Feb 27 at 16:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.