It's all about the answers!

Ask a question

How do you access and use the IWorkspaceConnectionInteropAdapter interface?


Thorsten Ferres (1367) | asked Feb 14 '14, 10:13 a.m.
converted to question Feb 19 '14, 2:07 p.m. by Geoffrey Clemm (30.0k23035)
Hello Michael,

could you please explain how to access and use the IWorkspaceConnectionInteropAdapter interface in more detail?

Thanks, Thorsten

One answer



permanent link
Michael Valenta (3.7k3) | answered Feb 14 '14, 11:13 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Here's how you get the adapter from a workspace connection.

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
Thorsten Ferres commented Feb 19 '14, 8:08 a.m. | edited Feb 19 '14, 2:09 p.m.

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?


Michael Valenta commented Feb 19 '14, 8:38 a.m. | edited Feb 19 '14, 2:09 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

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.


Thorsten Ferres commented Feb 19 '14, 10:55 a.m. | edited Feb 19 '14, 2:09 p.m.

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).


Michael Valenta commented Feb 19 '14, 1:44 p.m. | edited Feb 19 '14, 2:09 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

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.

Your answer


Register or to post your answer.