How to get the change sets for a certain file
One answer
There is a getBlame method on com.ibm.team.filesystem.client.IFileSystemView.
In the list, entry n is the IChangeSet responsible for producing line n in the file. (line numbering starts at 0).
You can find an ISharingDescriptor which will give you the workspace handle and component handle.
IFileSystemManager manager = FileSystemCore.getFileSystemManager(workspaceConnection.teamRepository()); IFileSystemView fsView = manager.getFileSystemView(workspaceConnection); List results = fsView.getBlame(component, fileItem, null, progressMonitor);
In the list, entry n is the IChangeSet responsible for producing line n in the file. (line numbering starts at 0).
How can I get the workspace handle so that I can get the workspaceConnection object and what is component and how do I get it?
You can find an ISharingDescriptor which will give you the workspace handle and component handle.
ISharingManager manager = FileSystemCore.getSharingManager(); IShareable shareable = manager.findShareable(new PathLocation(relativePath), ResourceType.FILE); ISharingDescriptor desc = shareable.getShare(progressMonitor).getSharingDescriptor(); IComponentHandle component = desc.getComponent(); IContextHandle workspace = desc.getConnectionHandle(); //should be instanceof IWorkspaceHandle