blob: b1b6ac557ae9a679ba9a8344d93a632ee1a935e7 [file] [log] [blame]
= User Guide =
== Getting Started ==
=== Installing EMF Compare ===
==== Marketplace Client ====
Using the bundled Eclipse marketplace client you can install EMF Compare in one click. Just type "emf compare", click on search, and then on install.
[[Image:./../images/Marketplace.png]]
==== Update Site ====
EMF has been part of the Eclipse release train since Galileo, you can install it using the following update sites, depending on your platform. '''Note''' that the following are not meant to be visited in your internet browser; they must be pasted in the ''Help > Install New Software'' dialog of your Eclipse, as p2 repositories.
http://download.eclipse.org/releases/mars
http://download.eclipse.org/releases/luna
http://download.eclipse.org/releases/kepler
http://download.eclipse.org/releases/juno
http://download.eclipse.org/releases/indigo
http://download.eclipse.org/releases/helios
http://download.eclipse.org/releases/galileo
The [http://www.eclipse.org/emf/compare/downloads/ Download page] lists more specific update sites if you wish to try one of the latest integration builds.
==== Compatibility ====
Please note that the EMF Compare development team does its best to maintain downward compatibility towards Helios (Eclipse 3.6). Following is the compatibility chart :
{| border="1"
|-
! EMF Compare
! bgcolor="#cccccc" align="center" | Eclipse 4.5 - EMF 2.11
! align="center" | Eclipse 4.4 - EMF 2.10
! align="center" | Eclipse 4.3 - EMF 2.9
! align="center" | Eclipse 4.2 - EMF 2.8
! align="center" | Eclipse 3.8 - EMF 2.8
! align="center" | Eclipse 3.7 - EMF 2.7
! align="center" | Eclipse 3.6 - EMF 2.6
! align="center" | Eclipse 3.5 - EMF 2.5
! align="center" | Eclipse 3.4 - EMF 2.4
! align="center" | Eclipse 3.3 - EMF 2.3
! align="center" | Eclipse 3.2 - EMF 2.2
|-
| bgcolor="#cccccc" align="center" | 3.1
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
|-
| bgcolor="#ffffff" align="center" | 3.0
| bgcolor="#ffffff" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
|-
| align="center" | 2.1
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
|-
| align="center" | 2.0
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
|-
| align="center" | 1.3
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
|-
| align="center" | 1.2
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
|-
| align="center" | 1.1
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#9d261d" |  
| bgcolor="#9d261d" |  
|-
| align="center" | 1.0
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#ffffff" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#46a546" |  
| bgcolor="#9d261d" |  
|}
An empty cell indicates that the compatibility hasn't been tested for a particular combination.
=== User Interface Breakdown ===
The main points of interest are highlighted in the following picture :
[[Image:./../images/EMF_Compare_User_Interface.png|center|EMF Compare's basic user interface]]
# Overview of the differences detected between the given two (or three) models.
# First version of the compared models.
# Second version of the compared models.
# This button will only be visible in the case of three-way comparisons (for example, comparing with a remote repository). It will make a third version of the compared model (the common ancestor of the two others) visible in the interface.
# When you select a difference in the top panel, the consequences of the merge of this difference are highlighted in green and red.
#* The consequences highlighted in <span style="color:green">green</span> are the differences that will be merge with the selected difference.
#* The consequences highlighted in <span style="color:red">red</span> are the differences that will be not "mergeable" after the merge of the selected difference.
#* A click on a <span style="color:green">green</span> or <span style="color:red">red</span> rectangle in the right gutter will lead you to the concerned consequence.
==== Toolbar ====
The toolbar displays the current status of the comparison and allows you to act on differences.
[[Image:./../images/EMF_Compare_User_Interface_Toolbar.png|center|EMF Compare's user interface toolbar]]
# Gives the number of differences still to be merged, and the number of differences filtered from the view.
# Allows to change the direction of consequences that are highlighted in green and red in the top panel. You can either display the consequences of a merge from left to right or right to left.
# Allows you to merge the single, currently selected difference in a given direction (left to right, or right to left).
# Allows you to merge all non conflicting differences (left to right, or right to left) at once.
# Allows you to navigate through the detected differences.
# Allows to expand/collapse all differences in the top panel.
# This button will allow you to group differences together in the structural view. For example, grouping all "Additions" or "Deletions" together.
# This button will allow you to filter some differences out of the view according to a set predicate. For example, filtering out all "Additions" or "Moves".
# Allows to save the comparison model.
When you compare models with one in a read-only mode, some of actions proposed by the toolbar are slightly different. Indeed, if you compare a model with the local history, or you compare a model with a remote model stored in a repository (e.g. via EGit), the latter is in a read-only mode. You will not able to merge differences to this read-only model. You will only accept or reject changes for your local model.
[[Image:./../images/EMF_Compare_User_Interface_Toolbar_With_Read_Only_Side.png|center|EMF Compare's user interface toolbar]]
# Allows to change the kind of consequences that are highlighted in green and red in the top panel. You can either display the consequences of accepting/rejecting the selected change.
# Allows you to accept the single, currently selected change.
# Allows you to reject the single, currently selected change.
# Allows you to accept all non conflicting changes at once.
# Allows you to reject all non conflicting changes at once.
==== Contextual menu in the overview of differences ====
In the area that shows the overview of differences, you also can perform merge actions using the contextual menu (i.e., right-click an item in the tree). These actions correspond to those in the [#Toolbar|toolbar].
If you do a right-click on a ''difference'' in the viewer, a contextual menu offers you to merge the selected difference.
* With local models
[[Image:./../images/EMF_Compare_ContextualMenu_Differences.png|center|EMF Compare's user interface contextual menu]]
* With a read-only side (comparison with EGit)
[[Image:./../images/EMF_Compare_ContextualMenu_Differences_02.png|center|EMF Compare's user interface contextual menu]]
If you do a right-click on a ''model element'' or a ''resource'', you can merge all contained non-conflicting differences with one click.
* With local models
[[Image:./../images/EMF_Compare_ContextualMenu_ContainedDifferences.png|center|EMF Compare's user interface contextual menu]]
* With a read-only side (comparison with EGit)
[[Image:./../images/EMF_Compare_ContextualMenu_ContainedDifferences_02.png|center|EMF Compare's user interface contextual menu]]
==== Signification of icons associated with differences ====
When you run a comparison involving two models (a 2-way comparison), the icons associated with differences are:
* [[Image:./../images/add_ov.gif|Addition]] represent an addition in the left side model of the comparison.
* [[Image:./../images/del_ov.gif|Deletion]] represent a deletion in the left side model of the comparison.
* [[Image:./../images/chg_ov.gif|Change]] represent a change (set/unset/move) in the left side model of the comparison.
When you run a comparison involving three models (a 3-way comparison), the icons associated with differences are:
*[[Image:./../images/r_inchg_ov.gif|Incoming change]] incoming differences are changes that were made in the right-side/remote model since common ancestor.
*[[Image:./../images/r_outchg_ov.gif|Outgoing change]] outgoing differences are changes that were made in the left-side/local model since common ancestor.
*[[Image:./../images/r_inadd_ov.gif|Incoming addition]] represent an incoming addition difference.
*[[Image:./../images/r_indel_ov.gif|Incoming deletion]] represent an incoming deletion difference.
*[[Image:./../images/r_outadd_ov.gif|Outgoing addition]] represent an outgoing addition difference.
*[[Image:./../images/r_outdel_ov.gif|Outgoing deletion]] represent an outgoing deletion difference.
*[[Image:./../images/confr_chg_ov.gif|Incoming conflict]] incoming conflict differences are changes that were made in the right-side/remote model since common ancestor, and are in conflict with the left-side/local model.
*[[Image:./../images/confchg_ov.gif|Outgoing conflict]] outgoing conflict differences are changes that were made in the right-side/remote model since common ancestor, and are in conflict with the right-side/remote model.
*[[Image:./../images/confr_add_ov.gif|Incoming conflict addition]] represent an incoming addition conflict.
*[[Image:./../images/confr_del_ov.gif|Incoming conflict deletion]] represent an incoming deletion conflict.
*[[Image:./../images/confadd_ov.gif|Outgoing conflict addition]] represent an outgoing addition conflict.
*[[Image:./../images/confdel_ov.gif|Outgoing conflict deletion]] represent an outgoing deletion conflict.
*[[Image:./../images/pconfr_chg_ov.gif|Incoming pseudo conflict]] incoming pseudo conflict differences are changes that were made in the right-side/remote model since common ancestor, and are in pseudo conflict with the left-side/local model.
*[[Image:./../images/pconfchg_ov.gif|Outgoing pseudo conflict]] outgoing pseudo conflict differences are changes that were made in the right-side/remote model since common ancestor, and are in pseudo conflict with the right-side/remote model.
*[[Image:./../images/pconfr_add_ov.gif|Incoming pseudo conflict addition]] represent an incoming pseudo conflict addition.
*[[Image:./../images/pconfr_del_ov.gif|Incoming pseudo conflict deletion]] represent an incoming pseudo conflict deletion.
*[[Image:./../images/pconfadd_ov.gif|Outgoing pseudo conflict addition]] represent an outgoing pseudo conflict addition.
*[[Image:./../images/pconfdel_ov.gif|Outgoing pseudo conflict deletion]] represent an outgoing pseudo conflict deletion.
==== After merge ====
The ''merged'' differences are displayed in <span style="color:gray">gray</span> and have a distinct icon.
*[[Image:./../images/merged_left_ov.gif|Merged difference from right to left]] represent a difference that has been merged from right to left.
*[[Image:./../images/merged_right_ov.gif|Merged difference from left to right]] represent a difference that has been merged from left to right.
When you compare models with one in a read-only mode, the icons are:
*[[Image:./../images/merged_ov.gif|Accepted change]] represent a change that has been accepted.
*[[Image:./../images/removed_ov.gif|Rejected change]] represent a change that has been rejected.
==== Merge actions recap ====
The following table shows the state the model should be in after clicking on EMF Compare comparison editor toolbar's buttons:
{| border="1" cellpadding="10" cellspacing="0" align="center"
!What it should be
!Type of Difference
!Ancestor Model
!Left/Local Model
!Right/Remote Model
![[Image:./../images/merge_to_right.gif|Merge to right]] Merge to right
![[Image:./../images/merge_to_left.gif|Merge to left]] Merge to left
![[Image:./../images/accept_change.gif|Accept change]] Accept
![[Image:./../images/reject_change.gif|Reject change]] Reject
![[Image:./../images/merge_all_to_right.gif|Merge all non-conflicting left differences to right]] Merge all non-conflicting left differences to right
![[Image:./../images/merge_all_to_left.gif|Merge all non-conflicting right differences to left]] Merge all non-conflicting right differences to left
![[Image:./../images/accept_all_changes.gif|Accept all changes]] Accept all
![[Image:./../images/reject_all_changes.gif|Reject all changes]] Reject all
|- align="center"
|3-way
|[[Image:./../images/r_outdel_ov.gif|Outgoing deletion]] Outgoing deletion
|X
|/
|X
|RIGHT = /
|LEFT = X
|MARK AS MERGED
|LEFT = X
|RIGHT = /
|DO NOTHING
|MARK AS MERGED
|LEFT = X
|- align="center"
|
|[[Image:./../images/r_indel_ov.gif|Incoming deletion]] Incoming Deletion
|X
|X
|/
|RIGHT = X
|LEFT = /
|LEFT = /
|MARK AS MERGED
|DO NOTHING
|LEFT = /
|LEFT = /
|MARK AS MERGED
|- align="center"
|
|[[Image:./../images/r_outadd_ov.gif|Outgoing addition]] Outgoing addition
|/
|X
|/
|RIGHT = X
|LEFT = /
|MARK AS MERGED
|LEFT = /
|RIGHT = X
|DO NOTHING
|MARK AS MERGED
|LEFT = /
|- align="center"
|
|[[Image:./../images/r_inadd_ov.gif|Incoming addition]] Incoming Addition
|/
|/
|X
|RIGHT = /
|LEFT = X
|LEFT = X
|MARK AS MERGED
|DO NOTHING
|LEFT = X
|LEFT = X
|MARK AS MERGED
|- align="center"
|2-way
|[[Image:./../images/del_ov.gif|Deletion]] Deletion
|
|/
|X
|RIGHT = /
|LEFT = X
|MARK AS MERGED
|LEFT = X
|RIGHT = /
|LEFT = X
|MARK AS MERGED
|LEFT = X
|- align="center"
|
|[[Image:./../images/add_ov.gif|Addition]] Addition
|
|X
|/
|RIGHT = X
|LEFT = /
|MARK AS MERGED
|LEFT = /
|RIGHT = X
|LEFT = /
|MARK AS MERGED
|LEFT = /
|}
==== Items for not loaded fragments ====
When a model is split into fragments, and only some of them have changes, the structure merge viewer (upper part of the comparison editor) and the content merge viewers (lower parts of the comparison editor) display the models involved in the comparison but don’t display the fragments that have no changes.
If a change (x) is detected in a fragment (B), and this fragment is a child of another fragment (A) that has no changes, then (A) won't appear in the structure merge viewer (upper part of the comparison editor) and the content merge viewers (lower parts of the comparison editor). As a result, users will think (B) is the root of the global model.
To avoid this, the idea is to display intermediate node(s) (represented as [ ... ]) in order to show to users that it exists something (fragments, i.e. a parts of models) between/above the changes.
{| border="1" cellpadding="5" cellspacing="0" align="center"
|-
! align="center" | Before
! align="center" | After
|-
| [[Image:./../images/EMF_Compare_NotLoadedItems_1.png|650px|center]]
| [[Image:./../images/EMF_Compare_NotLoadedItems_2.png|650px|center]]
|}
== Launch Comparison ==
Once installed, you can compare your files (locally or from EGit Version Control System) as usual using the '''Compare With''' menu. See [[#Known_Bugs_and_Limitations]] section to see how to benefit from EGit support.
=== Compare with local models ===
==== Compare with each other ====
You can compare two or three models by selecting them and then using the '''Compare With > Each Other''' menu:
[[Image:./../images/EMF_Compare_With_Each_Other.png|center]]
If you run a 3-way comparison (with 3 models), you have to select the ancestor of the comparison:
[[Image:./../images/EMF_Compare_Select_Common_Ancestor.png|center]]
==== Compare with local history ====
You can also compare your local model with one of its previous version available in the local history. For that, use the '''Compare With > Local History''' menu:
[[Image:./../images/EMFC_Compare_With.png|center]]
=== Compare with remote models (EGit) ===
The following displays the important part of a model life cycle with regards to the comparison. The full life cycle can be followed on [[./sample-use-case.html| Sample Use Case]].
See [[#Known_Bugs_and_Limitations]] section to see how to benefit from EGit support.
==== Compare with latest ====
For this test, we'll suppose that you are trying to use EMF Compare on UML models shared under git. This will not go in details about UML and Git. We'll assume that you know how to manipulate an UML model, create or clone a git repository, share a project under it and use standard Git operations.
The name of our sample project will be "library". It contains a single folder "model" containing two models :
* library_Types.uml will contain our primitive types,
* library.uml will contain our actual model.
The model itself is a very simple library. Graphically speaking :
[[Image:./../images/EMF_Compare_Use_Model.png]]
We commit this initial file as the original model. We then slightly modify it so that it now looks like :
[[Image:./../images/EMF_Compare_Use_Model_Changed.png]]
But how do we know exactly what changed? Let's compare this with the file from the Git Index :
[[Image:./../images/EMF_Compare_Use_Compare_1.png]]
This will open a comparison editor. Let's select one of the differences displayed on its top half :
[[Image:./../images/EMF_Compare_Use_Compare_3.png]]
# We've selected the difference corresponding to the addition of attribute '''alias''' in the class '''Writer'''. A double-click on this difference updated our two panes below.
# '''alias''' has been added to the properties of Class '''Writer'''. In the model, this corresponds to a change to the reference ''ownedAttributes'' of the ''Writer'' Class. This sub-panel indicates the actual reference that was changed in oder to remind us of the context.
# This displays all values of the reference outlined in (2) as they are in the ''left'' model. This is where we see the new value, '''alias''' outlined.
# As for (2), this will display the context of the selected difference. The same reference will usually be displayed in both (2) and (4).
# This panel displays all values of the reference outlined in (4) as they are in the ''right'' model. In here, we see the location of '''alias''' outlined as an empty space. This rectangle is where the new value will be added if we merge it.
In this case, it is possible to merge towards the ''right'' : the ''index'' version of the model is editable, like any other file in the index. If we merge this difference towards the ''right'', then it will exist an ''unstaged'' version of the model, and a ''staged'' version of the model, that will include the merged difference.
But this comparison with index is mainly useful in order to determine exactly what changed in our version. Let's commit our changes on the ''master'' branch.
==== Compare two differing branches ====
After that, our model can evolve, and evolve separately in multiple branches. Let's consider the case where we would have a ''master'' branch differing from a ''borrowables'' branch such as the two look like this (the branching point was the model we've already displayed above) :
{| border="1" cellpadding="5" cellspacing="0" align="center"
|-
! align="center" | Master
! align="center" | Borrowables
|-
| [[Image:./../images/EMF_Compare_Use_Compare_Master.png|center]]
| [[Image:./../images/EMF_Compare_Use_Compare_5.png|center]]
|}
Before we continue working on our Borrowables branch, we'd like to retrieve all modifications that have been pushed to master. With the "Borrowables" branch checked out, we'll use the ''Compare With > Branch, Tag or Reference'' action :
[[Image:./../images/EMF_Compare_Use_Compare_With_Master_1.png|center]]
and compare with master :
[[Image:./../images/EMF_Compare_Use_Compare_With_Master_2.png|center]]
This shows us all differences between our local copy and the master branch that were made since the 'branching' point.
[[Image:./../images/EMF_Compare_Merge.png|center]]
Same as previously, you can navigate through the differences via the top panel, the structural view. There are three main kind of elements displayed here. '''Regular''' elements, that mimic the containment tree of your input models, are there to separate the various differences and let you know where they were actually detected. Then there are '''incoming''' differences, decorated with a blue arrow ([[Image:./../images/EMF_Compare_Incoming_Change.gif]]) or a derived icon, and '''outgoing''' differences decorated with a gray arrow ([[Image:./../images/EMF_Compare_Outgoing_Change.gif]]) or a derived icon.
'''Incoming''' differences are changes that were made in the remote branch (here, ''master'') since the branching point (common ancestor).
'''Outgoing''' differences are changes that were made in the local copy (here, the ''borrowables'' branch) since the branching point.
There are no conflicts here, since UML uses computed identifiers (XMI ID) for the model elements. Thus, what looks like a conflict (the "Date" type that's been added on both branch in the types packages) is actually two distinct differences.
The interface also lets you display the common ancestor of both models through the [[Image:./../images/EMF_Compare_Ancestor.gif]] icon. For example, if we select the '''Book''' class, we can see how it looks like on all three versions :
[[Image:./../images/EMF_Compare_Merge_Book_Ancestor.png|center]]
You can navigate through the differences using the appropriate actions, either the previous ([[Image:./../images/EMF_Compare_Prev_Diff.gif]]) or the next ([[Image:./../images/EMF_Compare_Next_Diff.gif]]) difference.
The remaining two actions are those that actually interest us here we can either accept all non-conflicting differences to the local copy through [[Image:./../images/accept_all_changes.gif]] or accept them one after the other through [[Image:./../images/accept_change.gif]].
Accept '''all''' differences is not what we seek : we want to keep the changes we made locally, not revert them to the state they had before the branching point (which is their current state on ''master'', the right side). We will then select all ''incoming'' differences (under the ''Right side'' node) one after the other and merge them one by one. This gives us our merged model :
[[Image:./../images/EMF_Compare_Merged.png|center]]
==== Resource name changes ====
In case of a comparison with remote models, EMF Compare will detect resource name changes. The comparison editor will allows you to accept or reject those changes. Furthermore, in case of a Papyrus diagram & model renaming (renaming all .di, .notation and .uml files), the 3 differences will be accepted or rejected together, in order to maintain the consistency of the models.
[[Image:./../images/EMF_Compare_ResourceNameChange.png|center]]
== Features ==
=== Grouping Differences ===
This feature allows you to group differences together in the structural view according to a set predicate. By default, EMF Compare provides four distinct grouping strategies :
[[Image:./../images/EMF_Compare_Groups_Choice.png]]
; Default : Do not try and group differences together, display them as they were detected.
[[Image:./../images/EMF_Compare_Groups_Default.png]]
; By Kind : Group differences by their kind (''additions'', ''deletions'', ''moves'', ''changes'').
[[Image:./../images/EMF_Compare_Groups_Kind.png]]
; By Side : Group differences according to their side: left or right and a special group regrouping differences in conflicts with other differences together. This grouping strategy is display by default in case of a 3-way comparison.
[[Image:./../images/EMF_Compare_Groups_Side.png]]
; By Resource : Group differences according to their resource: useful when more than two resources involved in comparison and/or resources are split into fragments.
[[Image:./../images/EMF_Compare_Groups_Resource.png]]
New grouping strategies can be provided to EMF Compare through extension points. See [[./../developer/developer-guide.html#Add your own group|Add your own group]] section in developer guide for further details.
=== Filtering Differences ===
This features allows you to filter differences out of the structural view according to a set predicate. By default, EMF Compare provides four distinct filters :
[[Image:./../images/EMF_Compare_Filters_Choice.png]]
; Empty Resource Mappings : Filter out all resource mappings with no differences from the view. Enabled by default.
; Feature Map differences : Filters out differences that apply on EFEatureMapEntry type.
; Pseudo conflicts differences : Filter out all pseudo conflicts differences (only in case of a 3-way comparison). Enabled by default.
; Identical elements : Filter out all identical elements (elements with no differences). Enabled by default.
; Cascading differences : Filter out all differences that are contained under differences (except when in conflict). Enabled by default.
If you install UML support for EMF Compare, an additionnal filter will also be provided in case of a comparison invloving UML models:
All settings related to filters are explained in the [[#Filters]] customization section.
New filters can be provided to EMF Compare through extension points. See [[./../developer/developer-guide.html#Add your own filter|Add your own filter]] section in developer guide for further details.
=== Handling Conflicts ===
When a 3-way comparison has conflicts, all differences involved in the same conflict are grouped under a Conflict node.
In the following case, the Employee Smith has his manager reference in conflict. The left side of the comparison shows that the manager of the Employee Smith is the employee Lennon while the right side side shows that the manager is the Employee Webster.
The consequences of a merge from right to left of the selected difference are displayed.
When the left side difference ''Employee Lennon [ manager changed ]'' is selected in the top panel, the right side difference ''Employee Webster [ manager changed ]'' is highlighted in red, that means if the the left side difference ''Employee Lennon [ manager changed ]'' is merged from right to left, then it will be impossible to merge the right side difference ''Employee Webster [ manager changed ]'' from left to right.
[[Image:./../images/EMF_Compare_Handling_Conflict_1.png]]
After the merge of the left side difference from right to left ''Employee Lennon [ manager changed ]'', the right side difference ''Employee Webster [ manager changed ]'' is not "mergeable" from left to right anymore, it has been merged from right to left automatically.
[[Image:./../images/EMF_Compare_Handling_Conflict_2.png]]
=== Text Attribute Comparison ===
In case of differences made on ''String''-typed attributes, specifics actions are available in the top-right of the content viewer panel.
[[Image:./../images/EMF_Compare_Text_Compare.png]]
# Allows to merge all changes of the current difference.
# Allows to merge the current change.
# Allows to move to the next/previous textual difference (in case of multi-valuated ''String''-typed attributes).
# Allows to move to next/previous change in the current textual difference.
PENDING UPDATE, this demo displays EMF Compare 1.3
[http://www.eclipse.org/emf/compare/doc/features/videos/Text%20compare/textCompare.htm Demo]
=== Graphical Comparison ===
EMF compare provides the ability to compare models with Papyrus graphical modeler (GMF Diagrams). To get the graphical comparison, the ''EMF Compare Papyrus integration'' feature and Papyrus have to be installed. Note that the developments about Papyrus integration are not finished yet: the results might be not relevant.
The graphical comparison will be launched if you compare diagrams files (.di), or if you compare models that have diagrams associated in the same folder.
In the same way as the semantic model comparison, the graphical model comparison uses the same color coding, to distinguish <span style="color:blue">incoming</span> and <span style="color:gray">outgoing</span> changes, and <span style="color:red">conflicts</span>. To put in relief the graphical differences, some decorators are used:
*On one hand, to focus on the impacted objects, identifying them with markers. These markers are simple transparent rectangles which are set down above the concerned objects and are lightly larger.
*On the other hand, through phantoms (place-holders), to locate either the place where objects were deleted or the target location where objects should be added after merging.
The color of the concerned decorators are highlighted on selection of the difference.
In the following example, a 3-way comparison is run with UML class diagrams. We can see that a Shape associated to a semantic uml class named A has been added on the left side of the comparison. After selected the difference in top panel, we can see the concerned elements in down panels. In the left part, the Shape A is highlighted in gray because it is an incoming change. In the right part, a phantom is drawn at the place the Shape should be after merging from right to left.
[[Image:./../images/EMF_Compare_Graphical_AddClassA.png]]
About phantoms (place-holders):
To ease their readability, in some cases, their context have to be displayed:
*If they are nested in an other phantom (e.g. due to a delete of the parent object), this last contextual one is displayed at the same time as the main phantom concerned by the current selected change.
*If they are edges connected to deleted nodes or edges, these last contextual ones are displayed at the same time as the main edge phantom.
*The color of the contextual phantoms (dependencies) is not highlighted.
They are drawn as:
*A simple rectangle for nodes, at the same origin location (and size).
*A simple line (with the same bend points) for edges, at the same location.
*A simple line for nodes as element of containment list. For this case, the same LCS computation will be used to locate in the list, at the good index.
*Particular cases: If the location of the contextual phantoms was changed, the new location of the main phantom is computed.
**A node place-holder, related to a delete of a node, embedded in a node where the location changed.
**An edge place-holder between nodes where the location changed. In this case, the display of the line is drawn again.
Here is an example of nested phantom:
* the first capture represent an addition of a lifeline in sequence diagram.
[[Image:./../images/EMF_Compare_Graphical_Phantom.gif]]
* the second capture represent an addition of an execution inside the lifeline. We can see the phantom of the execution element, which is highlighted and the phantom of the lifeline parent, which is not highlighted.
[[Image:./../images/EMF_Compare_Graphical_Nested_Phantom.gif]]
Have a look on the following demos :
PENDING update videos
[[http://www.eclipse.org/emf/compare/doc/features/videos/EcoreTools-v2/EMFCompareEcoreTools.html | Demo : Comparing Ecore files with diagrams]]
[[http://www.eclipse.org/emf/compare/doc/features/videos/Papyrus/EMFComparePapyrus.html | Demo : Comparing UML files with diagrams]]
=== Logical Model ===
EMF Compare does not act simply on the selected files, but on their whole logical model (a given model can be split through multiple files through EMF ''control'' action). Thanks to that, if you try and compare a model file that reference other model files, the comparison will still be able to take these "other" files into account. For example, if you try and compare a ''genmodel'' file (that depends on its underlying ''ecore'' file) :
[[Image:./../images/EMF_Compare_Logical_Compare_Action.png]]
EMF Compare will actually consider both files when comparing :
[[Image:./../images/EMF_Compare_Logical_Compare_Result.png]]
PENDING UPDATE
[http://www.eclipse.org/emf/compare/doc/features/videos/LogicalModels/LogicalModels.html Demo]
=== UML Specialization ===
A specific work has been done with EMF Compare for UML. It consists in an additional filter named '''UML refined elements'''. This filter is active by default when a comparison involves UML resources.
Note that the developments about UML integration are not finished yet: the results might be not relevant.
[[Image:./../images/EMF_Compare_UML_Filter.png]]
The filter groups UML consistent differences together in one difference. For example, a UML association is modeled by an association element and several sub-elements:
[[Image:./../images/EMF_Compare_UML_Association.png]]
If EMF Compare detects a change on an element of type association, it will group all changes on the sub-elements of the association to the association difference.
The goal of this filter is to ease the merge of differences. Indeed, all you have to do is to merge the association difference and it will merge all the sub-differences with it.
Here is the comparison of two UML model, one with an association (the left side), another without (the right side). The '''UML refined elements''' filter has been deactivated:
[[Image:./../images/EMF_Compare_UML_Association_2.png]]
We can see a lot of differences.
The same comparison with the '''UML refined elements''' filter activated:
[[Image:./../images/EMF_Compare_UML_Association_3.png]]
PENDING
[[http://www.eclipse.org/emf/compare/doc/features/videos/UML%20comparison/compareUml.htm | Demo : Specific support to encapsulate profiles and stereotypes diffs]]
== Customization ==
=== Engines ===
During each comparison EMF Compare uses several engines (see [[./../developer/developer-guide.html#Comparison_Process|Comparison process]])
* Match engine
* Difference engine
* Equivalence engine
* Requirement engine
* Conflict detector
EMF Compare offers a way to configure those engines.
==== Match Engine ====
To customize matching phase go to the "Engines" preference page.
* Open preferences: Window > Preferences > EMF Compare
* Select "Engines" page
* Open Match tab
[[File:../images/EMF_Compare_Match_Engine_Preference_Page.png]]
===== Configure registered matching engine =====
Some of the registered Matching engines could be configured. If so, an extra panel will be displayed on the left part of the preference page when the Match engine is selected.
====== Matching strategy for default match engine ======
The matching strategy of the default match engine can be configured.
[[File:../images/EMF_Compare_Match_Engine_Preference_Page_Configuration.png]]
Basically, you can choose to use either a strategy based on object identifiers or a strategy based on object content or both.
* Only: Matching strategy based on id only. The match engine will only match two objects together if they have the same identifier. (see [[./../developer/developer-guide.html#Match_2 | Identifiers in Default Match Engine]]).
* Never: Matching strategy based on object content. Only the structure of the object will define if two objects can match.
* When available: This strategy will use both of the above strategies. If an identifier is found on an object then it will use the "Identifier Strategy" if not it will use the "Content strategy".
===== Enable/Disable Match Engines =====
Additional Match Engines can be contributed through EMF Compare's extension point (see [[./../developer/developer-guide.html#Overriding_the_Match_engine |Override Match Engine]]). They can be enabled or disabled from the preference page.
[[File:../images/EMF_Compare_Match_Engine_Preference_Page_List.png]]
* On this page you will find all registered match engines. They are ordered by priority (highest priority on top of the list). To enable an engine, check it. Uncheck the engine to disabled it. The first enabled Match engine that handles the comparison will be used.
==== For other engines ====
To customize one of the other phase, go to the "Engines" preference page.
* Open preferences: Window > Preferences > EMF Compare
* Select "Engines" page
* Open the tab corresponding to the phase to customize.
[[File:../images/EMF_Compare_Engines_Preference_Page.png]]
===== Choose the default engine =====
On this tab you can select which engine will be used by the comparison process. To do so, check the engine you want to define as default.
=== Post processors customization ===
Result of each phase of the comparison process (see [[./../developer/developer-guide.html#Comparison_Process|Comparison process]]) can be refined thanks to post processors.
More information:
* [[./../developer/developer-guide.html#Refine_the_default_Match_result|Refine Match Result]],
* [[./../developer/developer-guide.html#Refine_the_default_Diff_result|Refine Diff Result]],
* [[./../developer/developer-guide.html#Refine_the_default_equivalences|Refine Equivalence Result]]
* etc ...
To customize those post-processors go to the related preference page.
* Open preference page: Open Window > Preferences
* Select post-processors preference page: Select EMF Compare > Post Processors
[[File:../images/EMF_Compare_Post_Processor_Preference_Page.png]]
On this page you will find all registered post processors. They have been sorted by ordinal (top element of the list will be executed first). To enable or disable any post processor simply check or uncheck each of them. Unchecked post processors will not be triggered during later comparisons.
==== Model Resolvers ====
For each comparison, EMF Compare needs to define which resources are about to be compared. This scope is called the logical model (see [[./../developer/logical-model.html#What_is_a_logical_model_.3F | Logical Model]]). Model resolvers are used to define strategies to build this logical model.
The model resolvers will try and find cross referenced resources starting from the compared one in order to determine the logical model that needs to be compared along with it. This can be used to widen or reduce the scope in which EMF Compare will seek these linked resources.
To customize the model resolution behavior go to the "Resolution strategy" preference page.
# Open preferences: Window -> Preferences
# Open "Resolution strategy" preference page: EMF Compare > Resolution strategy
[[File:../images/EMF_Compare_Model_Resolver_Preference_Page.png]]
===== Choose a strategy =====
EMF Compare proposes different strategies:
* Workspace: Search for cross-references to (and from) the compared resource within all models from the workspace. '''This strategy is highly recommended in case of a comparison with remote models (EGit).'''
* Project: Search for cross-references to (and from) the compared resource within all models from its containing project.
* Container: Search for cross-references to (and from) the compared resource within all models from the same container.
* Outgoing: Only search for cross-references from the compared resource to its children (and recursively).
Other external strategies might be contributed to EMF Compare. In that case it may happen that the selected strategy can not handle a comparison. If it is so, EMF Compare will use the default strategy.
===== Disable model resolution =====
EMF Compare can prevent building the logical model. In that case, it will only compare the selected resources. To disable model resolution, check the button called "Disable model resolution".
=== User Interface customization ===
==== Colors Customization ====
You can customize the colors used by EMF Compare to highlight differences in the user interface.
# Open preferences: Window -> Preferences
# Go to Colors and Fonts preferences: Select -> General -> Appearance -> Colors and Fonts
# Open the EMF Compare Category.
# Select the color you want to customize and click and edit to pick a new color. Your editor will now use your new colors.
[[Image:./../images/EMFCompare_ColorPreferences.png]]
==== Filters ====
You have already been explained how to use filters to hide or display differences in EMF Compare UI (see [[#Toolbar]]). This chapter teaches you how to customize filter default activation.
First open the filters preference page:
* Open preferences: Window > Preferences > EMF Compare
* Select "Filters" page.
[[File:../images/EMF_Compare_Filters_Preference_Page.png]]
The first panel (1) is used to define which filters should be activated by default. Checked elements will be activated for later comparisons. Of course, only filters that can handle the comparison will be activated (for further explanations see [[./../developer/developer-guide.html#Add_your_own_filter|Add you own filter]]).
The second panel (2) is used to define the synchronization behavior between the filters selection in UI and the preferences. The combobox in the preference page has 3 distinct values:
* Always: Each time you will modify the filters selection in UI, the selected set of filters will be synchronized with the preferences. This way the filters that you have selected will be kept between comparisons.
* Never: The selection of filters in UI will never be synchronized with the preferences.
* Prompt: You will be asked each time that filters selection is modified if you want to synchronize the new set of filters with the preferences. If this option is set, a popup will appear just after each filter activation or deactivation. This popup proposes several ways to handle the newly selected set of filters: [[File:../images/EMF_Compare_Filters_Synchronization_Dialog.png]]
** If your answer is "Yes", the current set of selected filters will be synchronized with the preferences. In other word, it will become your default activated set of filters.
** If your answer is "No", nothing will be synchronized. Next time you will launch a comparison, the activated filters will be defined by the preferences.
** If you check "Do not ask me again", the above behaviors will be executed and the synchronization behavior will change. It will be set to "Always" if you have selected "Yes". It will be set to "Never" if you have selected "No".
==== Groups ====
You have already been explained how to use groups to gather differences in EMF Compare UI (see [[#Toolbar]]). This chapter teaches you how to customize the default activated group in EMF Compare.
First open the Groups preference page:
* Open preferences: Window > Preferences > EMF Compare
* Select "Groups" page.
[[File:../images/EMF_Compare_Groups_Preference_Page.png]]
This page is divided in two tabs. The first tab handles 2-way comparisons and the second tab handles 3-way comparisons.
Each tab contains two panels:
The top panel (1) is used to define the default group. EMF Compare uses an ordered list of groups to determine which group should be the default one. The first group in this list that can handle the comparison is chosen as default group. To change it, simply put the desired group in top of the list. To do so, use the up and down buttons located on the right side of the panel.
The bottom panel (2) is used to define a synchronization behavior between selected group in UI and the preferences. The combo box lets you choose between 3 different behaviors:
* Always: Each time you will select a group in UI, it will become the default group.
* Never: The selection of a group in UI will never modify the default group.
* Prompt: You will be asked each time you change the active group if you want to synchronize it with the preferences. A popup will appear. It will propose several ways to handle the newly selected group: [[File:../images/EMF_Compare_Groups_Synchronization_Dialog.png]]
** If your answer is "Yes", the current group will be synchronized with the preferences. In other word, it will become the default group.
** If your answer is "No", nothing will be synchronized. Next time you will start a comparison, the default group will be defined by the preferences.
** If you check "Do not ask me again", the above behaviors will be executed and the synchronization behavior will change. It will be set to "Always" if you have selected "Yes". It will be set to "Never" if you have selected "No".
==== Items providers ====
In EMF item providers are used to define how elements are displayed (label, icon etc..). They belong to the [http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.emf.doc%2Freferences%2Foverview%2FEMF.Edit.html EMF.Edit] framework. Item providers are generally contributed to EMF however it can happen that some of them are directly contributed to EMF Compare. In general, it's done if you want to customize the way elements are displayed in EMF Compare without impacting other editors. If you go to the preferences of EMF Compare you will find a page named "Item providers".
[[Image:../images/Item_Providers_Preference_Page.png]]
In this page, you will find all item providers that have been directly contributed to EMF Compare. Some elements are displayed in grayed meaning that can not be disabled. In our example you can see that "Notation item provider" is grayed. Indeed disabling it would produce incomprehensible results in EMF Compare UI on diagram comparisons. That's why its provider decided to prevents user from disabling it. All other elements can be enabled/disabled using the checkbox on the left of each label. For example the two other item providers can be disabled. If you want to know what an item provider is for, you can select it and a short description will appear in the "Description" field. For example, if you select "Stereotyped element item provider" you would read "This provider displays stereotyped elements like they were a new kind of UML element (it uses stereotype's icon and custom label)". This one can be disabled since without it a comparison result in EMF Compare UI would still be understandable for a user.
== Logical Model View ==
EMF Compare does not act simply on the selected files, but on their whole logical model (a given model can be split through multiple files through EMF control action). Thanks to that, if you try and compare a model file that reference other model files, the comparison will still be able to take these "other" files into account. For example, if you try and compare a genmodel file (that depends on its underlying ecore file), then both files will be taken into account for the comparison.
For more details about the logical model, please visit the [developer/logical-model.html|Logical model] page.
The EMF compare Logical Model View allows to see, for a given model (or set of models), the resulting logical model computed by EMF Compare.
The view is accessible from ''Window > Show View > Other ... > EMF Compare > Logical Model View''.
[[Image:./../images/EMF_Compare_LogicalModelView_ShowView.png]]
When you click on a model in the Package Explorer view or the Project Explorer view, or the focus is on an opened model editor, then the Logical Model view shows this model and all models linked with this one.
[[Image:./../images/EMF_Compare_LogicalModelView.png]]
While computing the logical model for a given model, the view shows the progression of computing.
[[Image:./../images/EMF_Compare_LogicalModelView_Computing.png]]
=== Toolbar ===
[[Image:./../images/EMF_Compare_LogicalModelView_Toolbar.png]]
1. The button ''Link with Editor and Selection'' synchronize the Logical Model View to the active editor or the selected element in the Package Explorer View.
*The editors taken into account to populate the View will be: EMF Compare's comparison models editor, Papyrus editors, and EMF Reflective Model editors.
*Any EMF model selected in the Package Explorer View will populate the View.
*This button will be disabled by default.
*When the Logical Model View is opened for the first time, the button is disabled, and '''no model is displayed''' in the view, '''even if one is selected''' in the Package/Project Explorer View or the active editor.
*When the button is enabled, the synchronization becomes active.
*When the button is disabled, the synchronization becomes inactive. The last logical model computed and displayed in the View will remains until the button was enabled again and a new editor be active or a model was selected, or else the View was closed.
2. The button ''View Menu''
[[Image:./../images/EMF_Compare_LogicalModelView_Toolbar_ViewMenu.png]]
* Flat list presentation: all models contained in the logical model are displayed as a flat list. Each item is followed by his relative path to the workspace.
[[Image:./../images/EMF_Compare_LogicalModelView_List.png]]
* Tree presentation: all models contained in the logical model are displayed as a tree, relative to the workspace.
[[Image:./../images/EMF_Compare_LogicalModelView_Tree.png]]
=== Contextual Menu ===
A contextual menu is accessible on each item displayed in the view.
Through this menu, you will able to open the item selected, access to its properties, compare it, etc...
[[Image:./../images/EMF_Compare_LogicalModelView_ContextMenu.png]]
== Known Bugs and Limitations ==
Here is the list of all open bugs of EMF Compare:
[https://bugs.eclipse.org/bugs/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&classification=Modeling&columnlist=bug_id%2Cproduct%2Ccomponent%2Cbug_status%2Ctarget_milestone%2Cresolution%2Cchangeddate%2Cshort_desc&known_name=EMFCompare%20all%20open&list_id=11857684&order=changeddate%20DESC%2Ccomponent%2Cbug_id%20DESC&product=EMFCompare&query_based_on=EMFCompare%20all%20open&query_format=advanced EMF Compare bugs]
Developments to compare shared models (via EGit) are not all included in offical releases EGit and EMF Compare yet. In order to let the customers to benefit such type of comparisons, you can download and install in your eclipse environment customs builds of EGit and EMF Compare that includes these additionnal developments. Note that the developments to fully supports comparisons with shared models via EGit are not finished yet: the results might be not relevant.
Here are the update sites:
* EGit (4.2.0) with additionnal developments to fully support comparisons with shared models: [http://download.eclipse.org/modeling/emf/compare/updates/egit-logical/integration/]
* EMF Compare (3.2.0) with additionnal developments to fully support comparisons with shared models: [http://download.eclipse.org/modeling/emf/compare/updates/logical/emf.compare/integration/latest/]
== Other Materials ==
*[http://www.eclipse.org/emf/compare/doc/features/videos/index.html Videos of 2011 new features]