How do you access and use the IWorkspaceConnectionInteropAdapter interface?
One answer
IWorkspaceConnection workspace = ???;
IWorkspaceConnectionInteropAdapter op = (IWorkspaceConnectionInteropAdapter)workspace.getAdapter(IWorkspaceConnectionInteropAdapter.class);
Once you have the adapter, you can use it to import a change set with a specified date and author.
Comments
Hello Michael,
I understand how to get the IWorkspaceConnectionInteropAdapter-object now, but I am unable to use the call of the method
IWorkspaceConnectionInteropAdapter.importChangeSet()
, which combines the calls
IWorkspaceConnection.createChangeSet()
:
IWorkspaceConnection.commit()
, because I need to create and commit new folders within the same change set - i.e. after I have created the change set but before I have finally committed the changed file. I do not want to create extra change sets just to add new folders. But as far as I understood I cannot pass more than one object in the collection of IConfigurationOp in the configOps-parameter of the importChangeSet() method that would allow me to commit / import both new folders and new file (contents) at the same time, right?
Thorsten,
The configOps collection of importChangeSet is the same collection that would be passed to IWorkspaceConnection#commit so you can certainly create new folders and files as well as change existing files.
I have now passed the IConfigurationOp-objects in an ArrayList for both files and folders (if required) to the importChangeSet() method, but I finally get a
java.lang.ArrayStoreException
at org.eclipse.emf.common.util.BasicEList.toArray(BasicEList.java:286)
at org.eclipse.emf.ecore.util.EcoreEList.toArray(EcoreEList.java:238)
at com.ibm.team.scm.client.internal.FlowNodeConnection.compareTo(FlowNodeConnection.java:979)
at com.ibm.team.scm.client.internal.FlowNodeConnection.compareTo(FlowNodeConnection.java:954)
:
when I call the method
IChangeHistorySyncReport changeSetSync = targetWorkspace.compareTo(
targetStream,
WorkspaceComparisonFlags.CHANGE_SET_COMPARISON_ONLY,
currentChangeSet.changes(), monitor);
with targetStream being the target stream I finally want to deliver my change sets to and currentChangeSet the change set returned by
IImportChangeSetResult.getChangeSet();
This is the call
ComponentHandle componentHandles[] = (ComponentHandle[]) excludedComponents.toArray(new ComponentHandle[excludedComponents.size()]);
so I guess the currentChangeSet.changes()-List contains objects of different types (i. e. changed files and folders).
The list that is passed to the compareTo method is supposed to be a list of components to be excluded from the comparison. It appears you are passing the changes fro a change set instead.