EMF Compare/API OpenEditorWithSelection

From Eclipsepedia

< EMF Compare
Revision as of 07:44, 13 October 2011 by Cedric.notot.obeo.fr (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The API enables to compute differences between models and open an EMF Compare editor from the result of the comparison and to select the differences about given model object identifiers.

  • void openEditor(final CompareEditorInput input, List<String> objectIds)
    

The input may be any input, instance of CompareEditorInput.

Here is an example to call this API in order to compare local models:

final IWorkbenchPage workBenchPage = TeamUIPlugin.getActivePage();

final IFile right = ResourcesPlugin.getWorkspace().getRoot().getFile("/org.eclipse.emf.compare.diagram.ui.tests/TC01_Added_nodes/TC2.ecorediag");

final IFile left = ResourcesPlugin.getWorkspace().getRoot().getFile("/org.eclipse.emf.compare.diagram.ui.tests/TC01_Added_nodes/TC1.ecorediag");

final ITypedElement iLeft = SaveablesCompareEditorInput.createFileElement(left);
final ITypedElement iRight = SaveablesCompareEditorInput.createFileElement(right);

final CompareEditorInput input = new SaveablesCompareEditorInput(null, iLeft, iRight, workBenchPage);

final List<String> uris = new ArrayList<String>();
for (String id : new String[] {"_sEwyAKfOEeC-6Yy0go4yvQ", "//EClass0" }) {
 uris.add(id);
}
CompareServices.openEditor(input, uris);