It's all about the answers!

Ask a question

Emulate "Open Local File" action of ChangeExplorer

Atul Kumar (1872329) | asked Jun 05 '14, 8:08 a.m.
I want to emulate the "Open Local File" action provided in the ChangeExplorer view in my application. All I have is the change-set information. From my view, I'm able to programmatically open ChangeExplorer view giving it ChangeSetInput.
Now, I want to give another action in my view that would do the "Open Local File" action.

Looked at SDK's OpenLocalFileAction class, which uses IShareable to open a file. How do I create an IShareable from a changeSet ? If that is possible, then I can use the OpenLocalFileAction directly.

Accepted answer

permanent link
Tim Mok (6.6k38) | answered Jun 05 '14, 10:53 a.m.
IShareable doesn't map to a change set. A shareable represents a resource that is shared with RTC. This can be a file so you'll have to look into the change set to get the items.

ISharingManager sharingManager = FileSystemCore.getSharingManager();

With the sharing manager, you can use the items from the change set (the versionables) to find the shareable on disk.

sharingManager.findShareables(versionableHandle, progressMonitor);
Atul Kumar selected this answer as the correct answer

Atul Kumar commented Jun 06 '14, 3:21 a.m.

Thanks Tim. I could achieve "Open Local File" action through following code:

final List<IShareable> shareables = new ArrayList<IShareable>();
ISharingManager sharingManager = FileSystemCore.getSharingManager();
IVersionableHandle versionHandle = (IVersionableHandle) IFileItem.ITEM_TYPE.createItemHandle(UUID.valueOf(fileUUID), UUID.valueOf(stateUUID));                                shareables.addAll((List<IShareable>)sharingManager.findShareables(versionHandle, new NullProgressMonitor()));
if(shareables.size() > 0) {
            OpenLocalFileAction.openLocalFile(parent.getShell(), getSite().getPage(), shareables.get(0));

Your answer

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.