fixed status
diff --git a/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/factory/SynchronizerMessageProvider.java b/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/factory/SynchronizerMessageProvider.java
index 24a3f06..a8d05b7 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/factory/SynchronizerMessageProvider.java
+++ b/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/factory/SynchronizerMessageProvider.java
@@ -11,23 +11,20 @@
 package org.eclipse.mylyn.docs.intent.client.synchronizer.factory;
 
 import org.eclipse.emf.compare.AttributeChange;
-import org.eclipse.emf.compare.ComparePackage;
 import org.eclipse.emf.compare.Diff;
+import org.eclipse.emf.compare.DifferenceKind;
 import org.eclipse.emf.compare.ReferenceChange;
-import org.eclipse.emf.compare.ResourceAttachmentChange;
+import org.eclipse.emf.ecore.EObject;
 import org.eclipse.mylyn.docs.intent.core.modelingunit.ResourceDeclaration;
 
 /**
  * Provide messages created from a given Diff.
  * 
  * @author <a href="mailto:alex.lagarde@obeo.fr">Alex Lagarde</a>
+ * @author <a href="mailto:william.piers@obeo.fr">William Piers</a>
  */
 public final class SynchronizerMessageProvider {
 
-	// TODO [COMPARE2] [SYNC] accurate sync status messages
-	/**
-	 * Represents a whitespace in a status message.
-	 */
 	private static final String SYNC_MESSAGES_WHITESPACE = " ";
 
 	private static final String SYNC_MESSAGES_INTERNAL_MODEL = "<b>Current Document</b>";
@@ -35,11 +32,6 @@
 	private static final String SYNC_MESSAGES_EXTERNAL_MODEL = "<b>Working Copy</b>";
 
 	/**
-	 * Represents the separation space between to status.
-	 */
-	private static final String SYNC_STATUS_SEPARATOR = "<br/><hr/><br/>";
-
-	/**
 	 * SynchronizerMessageProvider constructor.
 	 */
 	private SynchronizerMessageProvider() {
@@ -54,73 +46,137 @@
 	 */
 	public static String createMessageFromDiff(Diff diff) {
 		String returnedMessage = null;
-		try {
-			switch (diff.eClass().getClassifierID()) {
-				case ComparePackage.ATTRIBUTE_CHANGE:
-					returnedMessage = createMessageFromAttributeChange((AttributeChange)diff);
-					break;
-
-				case ComparePackage.REFERENCE_CHANGE:
-					returnedMessage = createMessageFromReferenceChange((ReferenceChange)diff);
-					break;
-
-				case ComparePackage.RESOURCE_ATTACHMENT_CHANGE:
-					returnedMessage = createMessageFromResourceAttachmentChange((ResourceAttachmentChange)diff);
-					break;
-
-				default:
-					break;
-
+		if (diff instanceof ReferenceChange) {
+			ReferenceChange referenceChange = (ReferenceChange)diff;
+			if (referenceChange.getReference().isContainment()) {
+				returnedMessage = createMessageFromContainmentChange(referenceChange);
+			} else {
+				returnedMessage = createMessageFromReferenceChange(referenceChange);
 			}
-		} catch (IllegalArgumentException e) {
-			returnedMessage = null;
+		} else if (diff instanceof AttributeChange) {
+			returnedMessage = createMessageFromAttributeChange((AttributeChange)diff);
 		}
+
 		if (returnedMessage == null) {
-			returnedMessage = SynchonizerEObjectNameGetter.computeObjectName(diff);
+			returnedMessage = diff.toString();
 		}
 		return returnedMessage;
 	}
 
 	/**
-	 * Create a message from the given AttributeChange element.
+	 * Create a message from the given Difference element.
 	 * 
-	 * @param difference
-	 *            the Diff used to create the returned message
-	 * @return a message created from the given AttributeChange element
-	 */
-	public static String createMessageFromAttributeChange(AttributeChange difference) {
-		return difference.toString();
-	}
-
-	/**
-	 * Create a message from the given ReferenceChange element.
-	 * 
-	 * @param difference
+	 * @param diff
 	 *            the Diff used to create the returned message
 	 * @return a message created from the given ReferenceChange element
 	 */
-	public static String createMessageFromReferenceChange(ReferenceChange difference) {
-		return difference.toString();
+	private static String createMessageFromContainmentChange(ReferenceChange diff) {
+		String elementLabel = SynchonizerEObjectNameGetter.computeObjectName(diff.getValue());
+		String returnedMessage = null;
+		switch (diff.getKind().getValue()) {
+			case DifferenceKind.ADD_VALUE:
+				returnedMessage = "The " + diff.getValue().eClass().getName();
+				if (elementLabel != null) {
+					returnedMessage += SYNC_MESSAGES_WHITESPACE + elementLabel;
+				}
+				returnedMessage += " is defined in the " + SYNC_MESSAGES_INTERNAL_MODEL
+						+ " model<br/>but not in the " + SYNC_MESSAGES_EXTERNAL_MODEL + " model.";
+				break;
+			case DifferenceKind.DELETE_VALUE:
+				returnedMessage = "The " + diff.getValue().eClass().getName();
+				if (elementLabel != null) {
+					returnedMessage += SYNC_MESSAGES_WHITESPACE + elementLabel;
+				}
+				returnedMessage += " is defined in the " + SYNC_MESSAGES_EXTERNAL_MODEL
+						+ " model<br/>but not in the " + SYNC_MESSAGES_INTERNAL_MODEL + " model.";
+				break;
+			default:
+				returnedMessage = createMessageFromReferenceChange(diff);
+				break;
+		}
+		return returnedMessage;
 	}
 
 	/**
-	 * Create a message from the given {@link ResourceAttachmentChange} element.
+	 * Create a message from the given Difference element.
 	 * 
-	 * @param difference
+	 * @param diff
 	 *            the Diff used to create the returned message
-	 * @return a message created from the given {@link ResourceAttachmentChange} element
+	 * @return a message created from the given ReferenceChange element
 	 */
-	public static String createMessageFromResourceAttachmentChange(ResourceAttachmentChange difference) {
-		return difference.toString();
+	private static String createMessageFromReferenceChange(ReferenceChange diff) {
+		String valueSignature = diff.getValue().eClass().getName();
+		String valueLabel = SynchonizerEObjectNameGetter.computeObjectName(diff.getValue());
+		if (valueLabel != null) {
+			valueSignature += SYNC_MESSAGES_WHITESPACE + valueLabel;
+		}
+
+		String returnedMessage = null;
+		String signature = "reference '" + diff.getReference().getName() + "'";
+
+		switch (diff.getKind().getValue()) {
+			case DifferenceKind.ADD_VALUE:
+				returnedMessage = "The " + valueSignature + " has been added to the " + signature;
+				break;
+			case DifferenceKind.DELETE_VALUE:
+				returnedMessage = "The " + valueSignature + " has been removed from the " + signature;
+				break;
+			case DifferenceKind.MOVE_VALUE:
+				returnedMessage = "The order of the values of the " + signature + " has changed";
+				break;
+			case DifferenceKind.CHANGE_VALUE:
+				returnedMessage = "The " + signature;
+				EObject element = diff.getMatch().getRight();
+				String elementLabel = SynchonizerEObjectNameGetter.computeObjectName(element);
+				if (elementLabel != null) {
+					returnedMessage += " in " + elementLabel;
+				}
+				returnedMessage += " has changed.<br/>";
+				returnedMessage += SYNC_MESSAGES_INTERNAL_MODEL + " : " + diff.getValue() + "<br/>"
+						+ SYNC_MESSAGES_EXTERNAL_MODEL + " : " + element.eGet(diff.getReference());
+				break;
+			default:
+				break;
+		}
+		return returnedMessage;
 	}
 
 	/**
-	 * Returns a String representing the separation space between to status.
+	 * Create a message from the given Difference element.
 	 * 
-	 * @return a String representing the separation space between to status
+	 * @param diff
+	 *            the Diff used to create the returned message
+	 * @return a message created from the given ReferenceChange element
 	 */
-	public static String getStatusSeparator() {
-		return SYNC_STATUS_SEPARATOR;
+	private static String createMessageFromAttributeChange(AttributeChange diff) {
+		String returnedMessage = null;
+		String signature = "attribute '" + diff.getAttribute().getName() + "'";
+
+		switch (diff.getKind().getValue()) {
+			case DifferenceKind.ADD_VALUE:
+				returnedMessage = "The " + diff.getValue() + " has been added to " + signature;
+				break;
+			case DifferenceKind.DELETE_VALUE:
+				returnedMessage = "The " + diff.getValue() + " has been removed from " + signature;
+				break;
+			case DifferenceKind.MOVE_VALUE:
+				returnedMessage = "The order of the values of " + signature + " has changed";
+				break;
+			case DifferenceKind.CHANGE_VALUE:
+				returnedMessage = "The " + signature;
+				EObject element = diff.getMatch().getRight();
+				String elementLabel = SynchonizerEObjectNameGetter.computeObjectName(element);
+				if (elementLabel != null) {
+					returnedMessage += " in " + elementLabel;
+				}
+				returnedMessage += " has changed.<br/>";
+				returnedMessage += SYNC_MESSAGES_INTERNAL_MODEL + " : " + diff.getValue() + "<br/>"
+						+ SYNC_MESSAGES_EXTERNAL_MODEL + " : " + element.eGet(diff.getAttribute());
+				break;
+			default:
+				break;
+		}
+		return returnedMessage;
 	}
 
 	/**
diff --git a/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/factory/SynchronizerStatusFactory.java b/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/factory/SynchronizerStatusFactory.java
index 4ff0366..7c24ab8 100644
--- a/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/factory/SynchronizerStatusFactory.java
+++ b/plugins/org.eclipse.mylyn.docs.intent.client.synchronizer/src/org/eclipse/mylyn/docs/intent/client/synchronizer/factory/SynchronizerStatusFactory.java
@@ -18,8 +18,8 @@
 import org.eclipse.emf.compare.AttributeChange;
 import org.eclipse.emf.compare.Diff;
 import org.eclipse.emf.compare.DifferenceKind;
+import org.eclipse.emf.compare.Match;
 import org.eclipse.emf.compare.ReferenceChange;
-import org.eclipse.emf.compare.ResourceAttachmentChange;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -72,18 +72,17 @@
 			Diff difference) {
 
 		List<CompilationStatus> statusList = new ArrayList<CompilationStatus>();
+		
 		SynchronizerCompilationStatus status = null;
 
 		if (difference instanceof AttributeChange) {
 			status = createStatusFromAttributeChange(indexEntry, (AttributeChange)difference);
 		} else if (difference instanceof ReferenceChange) {
 			status = createStatusFromReferenceChange(indexEntry, (ReferenceChange)difference);
-		} else if (difference instanceof ResourceAttachmentChange) {
-			status = CompilerFactory.eINSTANCE.createResourceChangeStatus();
 		}
 
 		if (status != null) {
-			if (difference.getKind().equals(DifferenceKind.MOVE_VALUE)) {
+			if (difference.getKind().equals(DifferenceKind.MOVE)) {
 				status.setSeverity(CompilationStatusSeverity.INFO);
 			} else {
 				status.setSeverity(CompilationStatusSeverity.WARNING);
@@ -104,9 +103,6 @@
 				status.setTarget(indexEntry.getResourceDeclaration());
 			}
 			statusList.add(status);
-		} else {
-			IntentLogger.getInstance().log(LogType.WARNING,
-					"CANNOT HANDLE DIFFERENCE " + difference.eClass().getName() + ": " + difference);
 		}
 		return statusList;
 	}
@@ -122,12 +118,12 @@
 	 */
 	private static ReferenceChangeStatus createStatusFromReferenceChange(TraceabilityIndexEntry indexEntry,
 			ReferenceChange difference) {
-		EObject compiledElement = difference.getMatch().getLeft();
+		EObject compiledElement = getCompiledElement(difference.getMatch());
 		IntentGenericElement target = null;
 		ReferenceChangeStatus status = CompilerFactory.eINSTANCE.createReferenceChangeStatus();
 		status.setCompiledElement(compiledElement);
 		status.setFeatureName(difference.getReference().getName());
-		status.setWorkingCopyElementURIFragment(createURIFragment(difference.getMatch().getRight()));
+		status.setWorkingCopyElementURIFragment(createURIFragment(getWorkingCopyElement(difference.getMatch())));
 		status.setChangeState(convertDifferenceKindToState(difference.getKind()));
 
 		target = getInstructionFromAffectation(indexEntry, compiledElement, difference.getReference(),
@@ -145,6 +141,34 @@
 		return status;
 	}
 
+	public static EObject getCompiledElement(Match match) {
+		EObject res = null;
+		if (match != null) {
+			res = match.getLeft();
+			if (res == null) {
+				EObject container = match.eContainer();
+				if (container instanceof Match) {
+					res = getCompiledElement((Match)container);
+				}
+			}
+		}
+		return res;
+	}
+
+	public static EObject getWorkingCopyElement(Match match) {
+		EObject res = null;
+		if (match != null) {
+			res = match.getRight();
+			if (res == null) {
+				EObject container = match.eContainer();
+				if (container instanceof Match) {
+					res = getWorkingCopyElement((Match)container);
+				}
+			}
+		}
+		return res;
+	}
+
 	/**
 	 * Creates the status related to the given difference.
 	 * 
@@ -156,16 +180,16 @@
 	 */
 	private static AttributeChangeStatus createStatusFromAttributeChange(TraceabilityIndexEntry indexEntry,
 			AttributeChange difference) {
-		EObject compiledElement = difference.getMatch().getLeft();
+		EObject compiledElement = getCompiledElement(difference.getMatch());
 		IntentGenericElement target = null;
 		AttributeChangeStatus status = CompilerFactory.eINSTANCE.createAttributeChangeStatus();
 		status.setCompiledElement(compiledElement);
 		status.setFeatureName(difference.getAttribute().getName());
-		status.setWorkingCopyElementURIFragment(createURIFragment(difference.getMatch().getRight()));
+		status.setWorkingCopyElementURIFragment(createURIFragment(getWorkingCopyElement(difference.getMatch())));
 		status.setChangeState(convertDifferenceKindToState(difference.getKind()));
 
-		target = getInstructionFromAffectation(indexEntry, difference.getMatch().getLeft(),
-				difference.getAttribute(), difference.getValue());
+		target = getInstructionFromAffectation(indexEntry, compiledElement, difference.getAttribute(),
+				difference.getValue());
 
 		// target setting: if affectation not found (or not available), use the parent compiled element
 		if (status != null) {