SCM - Best way to get workspace connection for a file?
Hello,
Just wanted to find out if there was an easier way to get the IWorkspaceConnection associated with a IResource? Currently I go through IResource > IShareable > IShare > ISharingDescriptor > IWorkspaceHandle. From the IWorkspaceHandle I cycle all repository connections trying to find that handle is the repository's connection manager. Needless to say it seems a lot of code for something which will be frequently called. Regards, Sri. |
7 answers
On Mon, 22 Oct 2007 23:47:58 -0400, Srimanth Gunturi wrote:
Currently I go through IResource > IShareable > IShare That is the right path to get the IWorkspaceHandle, once you have the handle you can call IWorkspaceManager.getWorkspaceConnection(handle, monitor), so there is no need to search for it within the workspace manager. - Dmitry |
On Wed, 24 Oct 2007 12:25:34 -0400, Srimanth Gunturi wrote:
But to get IWorkspaceManager, one would need to cycle through the To get the IWorkspaceManager you can call SCMPlatform.getWorkspaceManager(Repositories.getRepository (sharingDescriptor)); - Dmitry |
But to get IWorkspaceManager, one would need to cycle through the
repository connections in the workspace? Regards, Sri. Dmitry Karasik wrote: On Mon, 22 Oct 2007 23:47:58 -0400, Srimanth Gunturi wrote: |
Is it possible to get all the IWorkspaceHandles of the workspace? I mean is there a API to do that, not collecting them through searching the whole workspace (SharingDescriptor > IWorkspaceHandle)?
But to get IWorkspaceManager, one would need to cycle through the On Mon, 22 Oct 2007 23:47:58 -0400, Srimanth Gunturi wrote: |
Is it possible to get all the IWorkspaceHandles of the workspace? I mean The best you can do is: for (IShare share : ISharingManager.allShares()) { workspaces.add(share.getSharingDescriptor().getConnectionHandle()); } - Dmitry |
I found another solution that might be simpler: IWorkspaceConnection.getContextHandle()
Is it possible to get all the IWorkspaceHandles of the workspace? I mean The best you can do is: for (IShare share : ISharingManager.allShares()) { workspaces.add(share.getSharingDescriptor().getConnectionHandle()); } - Dmitry |
I found another solution that might be simpler: I thought you were talking about getting the workspace handles for all the shares in the eclipse workspace since this thread was about getting connections for filesystem objects and you said: "Is it possible to get all the IWorkspaceHandles of the workspace?" An IWorkspaceConnection has exactly 1 handle and you obtain it in exactly the way you said, with getContextHandle(). - Dmitry |
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.