# compareeditor in eclipsercp plugin verhält sich komisch



## Spot84 (26. Mai 2009)

Hallo allemann!
Ich wolte eine Eclipse RCP-Applikation schreiben die 2 UML-Modelle einliest und die Differenzen in einem Modellvergleichseditor anzeigt, wo diese dann auch gemischt werden können. Die Differenzen zwischen den Modellen berechnet mir EMF-Compare. Als Ergebnis erhält man dabei eine result.diff xmldatei. Das hab ich soweit auch alles hinbekommen. Diese result.diff datei kann man nun dem compareeditor von eclipse übergeben mittels der folgenden codezeilen.


```
ModelUtils.save(snapshot, "result.emfdiff");
ModelCompareEditorInput input = new ModelCompareEditorInput(snapshot);
CompareUI.openCompareEditor(input);
```

Der Editor öffnet sich nun auch aber er sieht anders aus als z.b. der von der emfcompare-seite. Die Symbole(von z.b. Klassen, Attributen..) werden anders dargestellt. Weiterhin bekomme ich eine Nullpointerexception wenn ich versuche die Modelle zu mischen.

Hat villeicht einer eine Idee woran das liegen könnte oder was ich falsch mache? Hab schon alles mögliche versucht und komm derzeit einfach nicht weiter. 
Eine Alternative zu org.eclipse.compare.compareUI.opencompareEdior() wäre auch hilfreich hauptsache ich muss den Editor nicht komplett neu schreiben, da dass meiner Meinung nach doch recht aufwendig wäre.

Vielen Dank schon einmal!!!


--> hier sind die Exceptions die beim Mischen auftreten

```
!ENTRY org.eclipse.ui 4 0 2009-05-25 16:08:42.173
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.emf.compare.EMFCompareException: Couldn't copy value
org.eclipse.emf.ecore.impl.EPackageImpl@1e2481b 
(eProxyURI: http://www.eclipse.org/uml2/schemas/Standard/1#/) of reference org.eclipse.emf.ecore.impl.
EReferenceImpl@130998 
(name: references) (ordered: true, unique: true, lowerBound: 0, upperBound: -1) 
(changeable: true, volatile: 
false, transient: false, defaultValueLiteral: null, unsettable: false, derived: false) 
(containment: false, resolveProxies: true)
 at org.eclipse.emf.compare.diff.merge.api.EMFCompareEObjectCopier.
copyReferenceValue(EMFCompareEObjectCopier.java:111)
 at org.eclipse.emf.compare.diff.merge.api.EMFCompareEObjectCopier.
copyReferenceValue(EMFCompareEObjectCopier.java:135)
 at org.eclipse.emf.compare.diff.merge.internal.impl.ReferenceChangeRightTargetMerger.
applyInOrigin(ReferenceChangeRightTargetMerger.java:48)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:174)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:136)
 at org.eclipse.emf.compare.diff.merge.internal.impl.DiffGroupMerger.applyInOrigin(DiffGroupMerger.java:35)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:174)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:136)
 at org.eclipse.emf.compare.diff.merge.internal.impl.DiffGroupMerger.applyInOrigin(DiffGroupMerger.java:35)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:174)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:136)
 at org.eclipse.emf.compare.diff.merge.internal.impl.DiffGroupMerger.applyInOrigin(DiffGroupMerger.java:35)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:174)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:136)
 at org.eclipse.emf.compare.diff.merge.internal.impl.DiffGroupMerger.applyInOrigin(DiffGroupMerger.java:35)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.doMerge(MergeService.java:174)
 at org.eclipse.emf.compare.diff.merge.service.MergeService.merge(MergeService.java:136)
 at org.eclipse.emf.compare.ui.ModelCompareInput.doCopy(ModelCompareInput.java:359)
 at org.eclipse.emf.compare.ui.ModelCompareInput.copy(ModelCompareInput.java:115)
 at org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer.
copy(ModelContentMergeViewer.java:349)
 at org.eclipse.compare.contentmergeviewer.ContentMergeViewer$8.
run(ContentMergeViewer.java:824)
 at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
 at org.eclipse.jface.action.ActionContributionItem.
handleWidgetSelection(ActionContributionItem.java:583)
 at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
 at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
 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.Display.runDeferredEvents(Display.java:3823)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
 at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
 at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
 at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
 at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
 at mergemodels.Application.start(Application.java:20)
 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.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(EclipseStarter.java:386)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.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)

!ENTRY org.eclipse.jface 4 2 2009-05-25 16:09:52.881
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NullPointerException
 at org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(ComposedAdapterFactory.java:340)
 at org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(ComposedAdapterFactory.java:277)
 at org.eclipse.emf.compare.util.AdapterUtils.adapt(AdapterUtils.java:55)
 at org.eclipse.emf.compare.util.AdapterUtils.getItemProviderText(AdapterUtils.java:110)
 at org.eclipse.emf.compare.diff.provider.RemoveReferenceValueItemProvider.
getText(RemoveReferenceValueItemProvider.java:105)
 at org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider.
getText(AdapterFactoryLabelProvider.java:374)
 at org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer$
ModelStructureLabelProvider.getText(ModelStructureMergeViewer.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(AbstractTreeViewer.java:932)
 at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.
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:175)
 at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1012)
 at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.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:175)
 at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2041)
 at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:827)
 at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractTreeViewer.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(TreeViewer.java:634)
 at org.eclipse.jface.viewers.AbstractTreeViewer.internalSetExpandedTreePaths(AbstractTreeViewer.java:2024)
 at org.eclipse.jface.viewers.AbstractTreeViewer.internalSetExpandedTreePaths(AbstractTreeViewer.java:2029)
 at org.eclipse.jface.viewers.AbstractTreeViewer.internalSetExpandedTreePaths(AbstractTreeViewer.java:2029)
 at org.eclipse.jface.viewers.AbstractTreeViewer.internalSetExpandedTreePaths(AbstractTreeViewer.java:2029)
 at org.eclipse.jface.viewers.AbstractTreeViewer.setExpandedTreePaths(AbstractTreeViewer.java:2405)
 at org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer.
inputChanged(ModelStructureMergeViewer.java:165)
 at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:274)
 at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1603)
 at org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer$
ConfigurationPropertyListener.propertyChange(ModelStructureMergeViewer.java:265)
 at org.eclipse.compare.CompareConfiguration.fireChange(CompareConfiguration.java:352)
 at org.eclipse.compare.CompareConfiguration.setProperty(CompareConfiguration.java:383)
 at org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer.
copy(ModelContentMergeViewer.java:382)
 at org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer.
copyDiffRightToLeft(ModelContentMergeViewer.java:406)
 at org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer$5
run(ModelContentMergeViewer.java:458)
 at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
 at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
 at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
 at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
 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.Display.runDeferredEvents(Display.java:3823)
 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
 at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
 at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
 at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
 at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
 at mergemodels.Application.start(Application.java:20)
 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.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(EclipseStarter.java:386)
 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.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)
```

// ein bild von dem editor in meinem rcp plugin(andere Symbole für klassen etc..)
http://s2.imgimg.de/uploads/editorrcp11d3ecf6JPG.jpg

// ein bild von dem emf-compare editor
http://s2.imgimg.de/uploads/editorinEclipse70761450JPG.jpg


----------



## Spot84 (26. Mai 2009)

hab es jetzt nach 3 tagen komischerweise auf einmal hinbekommen. in der runconfiguration müssen folgende plugins hinzugefügt werden:

damit die symbole dargestellt werden:
org.eclipse.uml2.uml.edit und
org.eclipse.uml2.common.edit

und für die exceptions
org.eclipse.uml2.uml.resources


----------



## Wildcard (26. Mai 2009)

Der Compare Editor verwendet für die visualisierung den von EMF generierten Edit Code über die entsprechenden Adapter Factories, daher benötigst du die zusätzlichen PlugIns.
Das Modell steht für sich selbst, der Code zum Editieren und Visualisieren wird jedoch nur als Adapter seperat bereitgestellt (MVA Prinzip).


----------



## Spot84 (26. Mai 2009)

vielen dank für die erklärung wildcard


----------

