It's all about the answers!

Ask a question

Dangling reference to workspace

Gidi Gal (962058) | asked Nov 19 '14, 10:25 a.m.
Hello to the forum members,

I have a reference to IWorkspace instance in my RTC extension. User may delete the workspace, resulting in dangling reference to IWorkspace. Is there an  API to recognize such dangling reference ? Currently, my way of recognizing such case is using code like:

     final IWorkspaceManager wsmgr = SCMPlatform..getWorkspaceManager((ITeamRepository) workspace.getOrigin());
     final IWorkspaceConnection wsc = wsmgr.getWorkspaceConnection(workspace, null); //Throws ItemNotFoundException
   //Do something with the workspace
} catch (ItemNotFoundException e) {
    //Update reference to workspace to null

If there is a more direct API to check validity of IWorkspace reference I'll be grateful for your comments. If there's an event I can listen to when workspace is deleted, that will be great as well.


Accepted answer

permanent link
Ralph Schoon (63.3k33646) | answered Nov 21 '14, 7:41 a.m.
Gidi, I don't think there is a more direct way. In it works for me.
Gidi Gal selected this answer as the correct answer

Gidi Gal commented Nov 27 '14, 3:42 a.m.

Thanks Ralph, I'll continue using this approach.

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.