It's all about the answers!

Ask a question

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


Andrew Ciaz (233) | asked Mar 04, 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"?>
<plugin>

   <extension
         point="org.eclipse.ui.popupMenus">
     <viewerContribution
      id="com.ibm.team.filesystem.ui.changes.views.LocalWorkspaceChangesView_7"
      targetID="com.ibm.team.filesystem.ui.changes.views.LocalWorkspaceChangesView">
      <visibility>
            <or>
            <objectClass name="com.ibm.team.filesystem.rcp.core.internal.changes.model.IWorkspaceSyncContext"/>
            <objectClass name="com.ibm.team.filesystem.rcp.core.internal.changes.model.IComponentSyncContext"/>
            <objectClass name="com.ibm.team.filesystem.rcp.core.internal.changes.model.IIncomingRemoteActivity"/>
            <objectClass name="com.ibm.team.filesystem.rcp.core.internal.changes.model.IIncomingActivitySource"/>
            <objectClass name="com.ibm.team.filesystem.rcp.core.internal.changes.model.IIncomingBaselineGroup"/>
            </or>
            </visibility>  
     <action
      class="com.ibm.test.CustomAction" icon="/images/Component_obj.gif"
       id=" com.ibm.test.customaction"  label="Custom Menu..."  style="push"/>
     </viewerContribution>  
   </extension>
</plugin>

Accepted answer


permanent link
Ralph Schoon (54.7k23641) | answered Mar 04, 3:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 This is really basically an Eclipse extension question. You should go to the Eclipse forums and search there. I have published something here: https://rsjazz.wordpress.com/2014/02/21/adding-context-menus-for-jazz-objects-to-the-rtc-eclipse-client/ that might be useful.

Ralph Schoon selected this answer as the correct answer

Comments
Andrew Ciaz commented Mar 04, 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, 5:52 a.m. | edited Mar 04, 5:55 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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, 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, 9:48 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
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: "com.ibm.team.filesystem.ui.changes.views.LocalWorkspaceChangesView").
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.