It's all about the answers!

Ask a question

How to add context menu in "Pending Changes" view in RTC?

Andrew Ciaz (59148) | asked Mar 04 '19, 3:15 a.m.

 Hi all, 

My requirement is add new context menu in RTC pending changes view in RTC, but after writting my plugin it is not visible in view. following is my plugin.xml file

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>

            <objectClass name=""/>
            <objectClass name=""/>
            <objectClass name=""/>
            <objectClass name=""/>
            <objectClass name=""/>
      class="" icon="/images/Component_obj.gif"
       id=""  label="Custom Menu..."  style="push"/>

Accepted answer

permanent link
Ralph Schoon (62.7k33643) | answered Mar 04 '19, 3:37 a.m.

 This is really basically an Eclipse extension question. You should go to the Eclipse forums and search there. I have published something here: that might be useful.

Ralph Schoon selected this answer as the correct answer

Andrew Ciaz commented Mar 04 '19, 3:54 a.m.

@Ralph Schoon Thanks for your feedback, I did code with eclipse views and it works fine, but when I tried with RTC eclipse it does not work. I also go through your artocle mentioned above, its regarding object contribution, and I am looking for viewer contribution 

Ralph Schoon commented Mar 04 '19, 5:52 a.m. | edited Mar 04 '19, 5:55 a.m.

The "Additions" and menu contribution should work the same. I am missing all the information to add to an existing menu in your plugin.xml. See my example. Anyway, I don't have more at the moment. 

Andrew Ciaz commented Mar 04 '19, 6:29 a.m.

@Ralph Schoon Thanks for guiding me but I think you are unable to understand my problem statement, by using object contribution I added menu in context menu of one object, but now I want to add menu in view's context menu. You are referring org.eclise.ui.menus and my requirement is org.eclipse.ui.opoupmenus 

David Lafreniere commented Jun 11 '19, 9:48 a.m.
Question on: "by using object contribution I added menu in context menu of one object, but now I want to add menu in view's context menu."

What do you mean by "view's context menu"? If you mean the little down arrow in the view header bar, the current code snippet would not do that.
<objectContribution> and <viewerContribution> are very similar... objectContribution lets you add a context menu to a specific type 'anywhere' it appears in Eclipse, whereas <viewerContribution> lets to add a context menu action to all types, but only in a specific view (of course filters can further be used to determine on which types the action appears).
It's not straight foward to add actions to the view menu. I suspect you can find the Eclipse ViewPart object (the PC view ID is: "").
From there you'd get:
IMenuManager menuManager = pcViewPart.getViewSite().getActionBars().getMenuManager();
and then add the desired actions to the Menu.

Your answer

Register or to post your answer.