Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » EMF Compare: Graphical comparison in GMF Editor(Use Extension points to compare diagrams in my GMF Editor)
EMF Compare: Graphical comparison in GMF Editor [message #1748721] Sun, 27 November 2016 22:14 Go to next message
Anthony Okala is currently offline Anthony OkalaFriend
Messages: 6
Registered: November 2016
Junior Member
Hello together,

is there a way to configure EMF Compare, so that i could graphically compare my diagrams with the extension "my_diagram".
i followed the tutorial on this page, but it is not working. So i set many breakpoints and i found out that the my custom contentMergeViewer class is not even called, but see my extentions:
<extension
         point="org.eclipse.core.contenttype.contentTypes">
      <content-type
            file-extensions="my_diagram, my"
            file-names="*"
            id="id.of.GMFModelContentType"
            name="GMF Compare"
            priority="normal">
      </content-type>
   </extension>
   <extension
         point="org.eclipse.compare.contentMergeViewers">
      <viewer
            class="path.to.CustomContentMergeViewerCreator"
            id="id.of.CustomContentMergeViewer">
      </viewer>
      <contentTypeBinding
            contentMergeViewerId="id.of.CustomContentMergeViewer"
            contentTypeId="emab.project.test3.diagram.GMFModelContentType">
      </contentTypeBinding>
   </extension>
   <extension
         point="org.eclipse.compare.structureMergeViewers">
      <viewer
            class="path.to.CustomStructureMergeViewerCreator"
            extensions="*"
            id="id.of.CustomStructureMergeViewerCreator">
      </viewer>
      <contentTypeBinding
            contentTypeId="id.of.diagram.GMFModelContentType"
            structureMergeViewerId="id.of.CustomStructureMergeViewerCreator">
      </contentTypeBinding>
   </extension>


how can i make a simple graphical comparison in my GMF Editor?
how must the customized content and structure merge Viewer look like?
did i missed extensions?
i want to start with that and later customize it the way i want.
i am opened for any suggestions
So please help me start.

Re: EMF Compare: Graphical comparison in GMF Editor [message #1748743 is a reply to message #1748721] Mon, 28 November 2016 09:32 Go to previous messageGo to next message
Philip Langer is currently offline Philip LangerFriend
Messages: 99
Registered: March 2015
Location: Vienna, Austria
Member

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

Re: EMF Compare: Graphical comparison in GMF Editor [message #1748969 is a reply to message #1748743] Wed, 30 November 2016 15:19 Go to previous message
Anthony Okala is currently offline Anthony OkalaFriend
Messages: 6
Registered: November 2016
Junior Member
Hi,
it helps a lot thank you!
Anthony
Previous Topic:"Previous" and "Next" buttons in main toolbar do nothing?
Next Topic:Determine if two Ecore xmi models are equal
Goto Forum:
  


Current Time: Thu Nov 07 03:39:07 GMT 2024

Powered by FUDForum. Page generated in 0.23422 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top