Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

LocalWorkspaceChangesView - selecting TreeItem in the pending changes view

Hello to the forum members,

I am selecting a certain TreeItem in the pending changes view: First I get the TreeViewer from LocalWorkspaceChangesView using getActiveViewer(). Then I get the Tree control using TreeViewer.getTree() and after I locate the required TreeItem I call Tree.setSelection(TreeItem).

The problem: When I right-click on the selected TreeItem, I cannot see "Check-in" option if the item is unresolved. If I right-click on the item again, "Check-in" appears. I tried to see if the related command (com.ibm.team.filesystem.ide.ui.command.checkin, if I understand correctly) has some condition for the menu display, I did not find one. So, my current proposed solution is to use java.awt.Robot to generate mouse-click on the selected item.

I'm quite sure there is a more elegant solution to this issue. I will be grateful if you could share it with me.

Many thanks in advance,
Gidi

0 votes

Comments

Some improvement for my solution: instead of using  java.awt.Robot I'm using org.eclipse.swt.widgets.Display.post(Event), so I don't mix AWT and SWT.

Well, the Display.post seems to be unreliable, so I'm back to the AWT solution, though I have my doubts about it as well... I did some more digging in RTC SDK, I found SaveIntoActivityContributionItem, if I understand correctly, it is related to "New change set" menu option under "Check in". I see in com.ibm.team.filesystem.ui.changes.views.Actions that it is added to the menu when  SaveIntoActivityContributionItem.isNeeded  returns true. isNeeded returns true according to returned local changes from call to ComponentSyncUtil.filter. So, I guess that when I select through API, local changes are empty, so SaveIntoActivityContributionItem is not added to the menu.

If you have idea how to update IComponentSyncModel so local changes will be filled according to the selection I did, I'll be grateful for your input. I tried calling IComponentSyncModel.refresh, but it did not do the trick.

Thanks,
Gidi

A bit better solution:
void org.eclipse.swt.widgets.Widget.notifyListeners(int eventType, Event event)
with the arguments SWT.Selection and new Event().
I activate it on the Tree instance after I call setSelection.


Be the first one to answer this question!

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938
× 1,202

Question asked: Oct 27 '16, 2:37 p.m.

Question was seen: 2,162 times

Last updated: Nov 01 '16, 10:37 a.m.

Confirmation Cancel Confirm