[525286] [Papyrus] Diffs in invisible stereotype property visualizations not filtered out by default

Pre-requisite for fixing the presentation of diffs for invisible stereotype property visualizations.

The diagram change factory erroneously thinks that a notation view that has its semantic element explicitly set to null inherits the semantic, which it does not.  The applied-stereotype comment views in Papyrus diagrams have explicit null elements, so without this fix, diffs for them are assigned instead to the diagram itself, which (a) doesn't make sense and (b) breaks the filtering to be implemented subsequently.

Bug: 525286
Change-Id: I20493be6a44595e4ca332aeaa786cc012ad3dbd8
Signed-off-by: Christian W. Damus <give.a.damus@gmail.com>
diff --git a/plugins/org.eclipse.emf.compare.diagram/src/org/eclipse/emf/compare/diagram/internal/factories/AbstractDiagramChangeFactory.java b/plugins/org.eclipse.emf.compare.diagram/src/org/eclipse/emf/compare/diagram/internal/factories/AbstractDiagramChangeFactory.java
index 3cbe58a..adf3d20 100644
--- a/plugins/org.eclipse.emf.compare.diagram/src/org/eclipse/emf/compare/diagram/internal/factories/AbstractDiagramChangeFactory.java
+++ b/plugins/org.eclipse.emf.compare.diagram/src/org/eclipse/emf/compare/diagram/internal/factories/AbstractDiagramChangeFactory.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013, 2015 Obeo.
+ * Copyright (c) 2013, 2017 Obeo and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  * 
  * Contributors:
  *     Obeo - initial API and implementation
+ *     Christian W. Damus - bug 525286
  *******************************************************************************/
 package org.eclipse.emf.compare.diagram.internal.factories;
 
@@ -147,8 +148,12 @@
 		if (result == null) {
 			result = match.getRight();
 		}
-		if (!(result instanceof View
-				&& ReferenceUtil.safeEGet(result, NotationPackage.Literals.VIEW__ELEMENT) != null)
+
+		// Be careful: a view can have the element explicitly set to null, which means that
+		// it is a free-standing shape. This happens, for example, with GeoShapes and
+		// certain views in Papyrus diagrams (such as applied-stereotype comments). These
+		// explicitly nulls do not indicate inheritance of semantic element from the parent
+		if (!(result instanceof View && result.eIsSet(NotationPackage.Literals.VIEW__ELEMENT))
 				&& match.eContainer() instanceof Match) {
 			result = getViewContainer((Match)match.eContainer());
 		}