I was wondering about the use of the EMF Compare API, because I have
encountered some problems with it.

I have simply coded an action to compare two EObjects, and to open an
editor with the differences.

Having the case that I have 2 identical models, if I run the action
between the 2 root eObjects of both models, all works fine as expected,
with 0 differences in the compare editor. However if I try to compare
the two same children of the root eObjects in both models, the compare
editor is opened with 1 difference. Besides, if I explore the
differences, a NPE is thrown.

// We open the Editor.
ModelCompareEditorInput editorInput = new
ModelCompareEditorInput(snapshot);
CompareUI.openCompareEditorOnPage(editorInput, page);
....

Below, The NPE thrown, while exploring the unexpected difference in the
editor.

Cheers,
Adolfo.

java.lang.NullPointerException
at
org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(C omposedAdapterFactory.java:340)
at
org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(C omposedAdapterFactory.java:277)
at org.eclipse.emf.compare.util.AdapterUtils.adapt(AdapterUtils .java:55)
at
org.eclipse.emf.compare.util.AdapterUtils.getItemProviderTex t(AdapterUtils.java:110)
at
org.eclipse.emf.compare.diff.provider.MoveModelElementItemPr ovider.getText(MoveModelElementItemProvider.java:110)
at
org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider .getText(AdapterFactoryLabelProvider.java:374)
at
org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMe rgeViewer$ModelStructureLabelProvider.getText(ModelStructure MergeViewer.java:333)
at
org.eclipse.jface.viewers.WrappedViewerLabelProvider.getText (WrappedViewerLabelProvider.java:108)
at
org.eclipse.jface.viewers.WrappedViewerLabelProvider.update( WrappedViewerLabelProvider.java:164)
at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn. java:145)
at
org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(Ab stractTreeViewer.java:932)
at
org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeR unnable.run(AbstractTreeViewer.java:102)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:17 5)
at
org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(Ab stractTreeViewer.java:1012)
at
org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRun nable.run(StructuredViewer.java:466)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:17 5)
at
org.eclipse.jface.viewers.StructuredViewer.updateItem(Struct uredViewer.java:2041)
at
org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem( AbstractTreeViewer.java:827)
at
org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractT reeViewer.java:802)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:70)
at
org.eclipse.jface.viewers.AbstractTreeViewer.createChildren( AbstractTreeViewer.java:776)
at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeView er.java:634)
at
org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpan d(AbstractTreeViewer.java:1442)
at
org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeVi ewer.java:927)
at
org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded( AbstractTreeViewer.java:1453)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:126)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
at org.eclipse.swt.widgets.Tree.wmNotifyChild(Tree.java:7306)
at org.eclipse.swt.widgets.Control.wmNotify(Control.java:4718)
at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:17 56)
at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:4348)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3841 )
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4528 )
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:227 4)
at org.eclipse.swt.widgets.Tree.callWindowProc(Tree.java:1529)
at org.eclipse.swt.widgets.Tree.WM_LBUTTONDOWN(Tree.java:6249)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:3822 )
at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:5791)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4541 )
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:23 71)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3420)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:21 98)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:193)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:386)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)

The NPE I can easily fix, but that wouldn't help with the root problem :
could you send me the models you compare or the result of the comparison
either here or via mail laurent (dot) goubet (at) obeo (dot) fr so that
I can try and see why we detected a diff? As for the NPE, it should be
fixed in the next build.

The NPE I can easily fix, but that wouldn't help with the root problem :
could you send me the models you compare or the result of the comparison
either here or via mail laurent (dot) goubet (at) obeo (dot) fr so that
I can try and see why we detected a diff? As for the NPE, it should be
fixed in the next build.