It's all about the answers!

Ask a question

LocalWorkspaceChangesView - selecting TreeItem in the pending changes view

Gidi Gal (962056) | asked Oct 27 '16, 2:37 p.m.
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 (, 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 Gal commented Oct 30 '16, 12:20 p.m.

Some improvement for my solution: instead of using  java.awt.Robot I'm using, so I don't mix AWT and SWT.

Gidi Gal commented Oct 31 '16, 2:12 p.m.

Well, the 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 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.


Gidi Gal commented Nov 01 '16, 10:37 a.m.

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 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.