|
Re: EMF Compare: Graphical comparison in GMF Editor [message #1748743 is a reply to message #1748721] |
Mon, 28 November 2016 09:32 |
|
Hi Anthony,
first, you have to register the file extension of your model as an EMF Compare content type as below.
<extension point="org.eclipse.core.contenttype.contentTypes">
<file-association content-type="org.eclipse.emf.compare.content.type" file-extensions="my_diagram"></file-association>
</extension>
This will tell EMF Compare to handle comparisons of your model. Once this is done, it should already work to see graphical diagram comparisons, as EMF Compare is integrated with GMF and provides basic diagram comparison support for any GMF-based diagram.
From this point on, you can further customize the comparison support, depending on what you aim to do.
To replace, for instance, the content merge viewer (this is the lower part of the comparison editor, which shows the left and right diagrams highlighting the selected change in the upper area of the comparison editor), you have to register a new content merge viewer for the "type" of the selected element in the upper part. The type is basically a string (ITypedElement), which is specified by the accessor of the element. By default for diagram changes and matches, it is diagramcompare_match and diagramcompare_diff.
Thus, to replace the content merge viewer with your own, you first have to specify an accessor factory, which provides your own types and then register your new content merge viewer for the new types of your accessor:
<extension
point="org.eclipse.emf.compare.rcp.ui.accessorFactory">
<factory
class="<your-accessor-factory>"
ranking="1000">
</factory>
</extension>
Your accessor factory has to return a typed element for left, right, and origin. The typed elements have to return the type in the implementation of getType(), which is just a String. For this String, you can then register your content merge viewer:
<extension
point="org.eclipse.compare.contentMergeViewers">
<viewer
class="<your-content-merge-viewer-implementation-class>"
extensions="<your-types>"
id="<your-id>"
label="<label>">
</viewer>
</extension>
Have a look at the implementation in org.eclipse.emf.compare.diagram.ide.ui to see an example for this mechanism.
Hope this helps,
Philip
--
Philip Langer
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
--
Philip Langer
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
[Updated on: Mon, 28 November 2016 09:33] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.23422 seconds