Remove EGenericTypes from semanticElements references

This commit change the VSM structure so that the ESuperType edge
mappings is no longer specifying that a reference to the EGenericTypes
of the EClass should be kept. As the genericsupertype reference in Ecore
has a fairly weird status (mutually derived, but not structurally
derived) that could cause a number of problems later one.

This commit replace this reference by a specific handling of the
properties views.

Change-Id: I92aa56527447eed90604122d82a3645e999d1e50
diff --git a/org.eclipse.emf.ecoretools.design/description/ecore.odesign b/org.eclipse.emf.ecoretools.design/description/ecore.odesign
index 1c5fee3..320158d 100644
--- a/org.eclipse.emf.ecoretools.design/description/ecore.odesign
+++ b/org.eclipse.emf.ecoretools.design/description/ecore.odesign
@@ -64,7 +64,7 @@
             </endLabelStyleDescription>
           </style>
         </edgeMappings>
-        <edgeMappings name="EC ESupertypes" deletionDescription="//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@toolSections.3/@ownedTools[name='Delete%20ESuperType']" semanticCandidatesExpression="" semanticElements="service:superTypeSemanticElements" synchronizationLock="true" sourceMapping="//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass'] //@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Related%20EClasses']/@containerMappings[name='EC%20External%20EClasses']" targetMapping="//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass'] //@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Related%20EClasses']/@containerMappings[name='EC%20External%20EClasses']" targetFinderExpression="service:getDirectSuperTypesOrMostSpecificVisibleOnes(diagram)" reconnections="//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@toolSections.4/@ownedTools[name='ReconnectESupertypeSource'] //@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@toolSections.4/@ownedTools[name='ReconnectESupertypeTarget']">
+        <edgeMappings name="EC ESupertypes" deletionDescription="//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@toolSections.3/@ownedTools[name='Delete%20ESuperType']" semanticCandidatesExpression="" semanticElements="var:self" synchronizationLock="true" sourceMapping="//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass'] //@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Related%20EClasses']/@containerMappings[name='EC%20External%20EClasses']" targetMapping="//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass'] //@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Related%20EClasses']/@containerMappings[name='EC%20External%20EClasses']" targetFinderExpression="service:getDirectSuperTypesOrMostSpecificVisibleOnes(diagram)" reconnections="//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@toolSections.4/@ownedTools[name='ReconnectESupertypeSource'] //@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@toolSections.4/@ownedTools[name='ReconnectESupertypeTarget']">
           <style targetArrow="InputClosedArrow" routingStyle="tree">
             <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
             <beginLabelStyleDescription showIcon="false" labelExpression="service:superTypesLabel">
@@ -1455,7 +1455,7 @@
         </actions>
       </pages>
       <pages name="execution_page" labelExpression="Execution" semanticCandidateExpression="var:self" preconditionExpression="aql:self.eContainerOrSelf(ecore::EPackage).isConfiguredForALE()" groups="//@extensions.0/@categories.0/@groups.7 //@extensions.0/@categories.0/@groups.8"/>
-      <groups name="default rules" labelExpression="aql:input.emfEditServices(self).getText()" semanticCandidateExpression="aql:self.removeSemanticElementsToHide(input.getAllSemanticElements())" preconditionExpression="">
+      <groups name="default rules" labelExpression="aql:input.emfEditServices(self).getText()" semanticCandidateExpression="aql:self.removeSemanticElementsToHide(input.getAllSemanticElements(),input.context().semanticDecorator())" preconditionExpression="">
         <controls xsi:type="properties:DynamicMappingForDescription" name="sirius_default_rules_structural_features_for" iterator="eStructuralFeature" iterableExpression="aql:self.removeFeaturesToHide(input.emfEditServices(self).getEStructuralFeatures())">
           <ifs name="sirius_default_rules_mono_string_if" predicateExpression="aql:input.emfEditServices(self).needsTextWidget(eStructuralFeature) and not input.emfEditServices(self).isMultiline(eStructuralFeature)">
             <widget xsi:type="properties:TextDescription" name="sirius_default_rules_mono_string" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)+':'" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:if eStructuralFeature.name = 'upperBound' and self.oclIsKindOf(ecore::ETypedElement) then self.upperBoundDisplay() else self.eGet(eStructuralFeature.name) endif">
diff --git a/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/EReferenceServices.java b/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/EReferenceServices.java
index e9c3df6..ea57e1b 100644
--- a/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/EReferenceServices.java
+++ b/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/EReferenceServices.java
@@ -176,15 +176,6 @@
         }
     }
 
-    public Collection<EObject> superTypeSemanticElements(EClass any) {
-        Set<EObject> result = Sets.newLinkedHashSet();
-        result.addAll(any.getEGenericSuperTypes());
-        for (EGenericType genType : any.getEGenericSuperTypes()) {
-            result.addAll(genType.getETypeArguments());
-        }
-        return result;
-    }
-
     public String superTypesLabel(EClass any) {
         Collection<String> reifiedTypes = Lists.newArrayList();
         Collection<String> typeParameters = Lists.newArrayList();
diff --git a/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/PropertiesServices.java b/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/PropertiesServices.java
index e09f22d..5e89569 100644
--- a/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/PropertiesServices.java
+++ b/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/PropertiesServices.java
@@ -24,6 +24,8 @@
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EGenericType;
 import org.eclipse.emf.ecore.EModelElement;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EParameter;
@@ -33,6 +35,9 @@
 import org.eclipse.emf.ecore.EcoreFactory;
 import org.eclipse.emf.ecore.EcorePackage;
 import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl;
+import org.eclipse.sirius.diagram.DEdge;
+import org.eclipse.sirius.diagram.description.EdgeMapping;
+import org.eclipse.sirius.viewpoint.DSemanticDecorator;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
@@ -92,13 +97,23 @@
 		}
 	}
 
-	public List<EObject> removeSemanticElementsToHide(EObject ctx, Collection<EObject> unfiltered) {
+	public List<EObject> removeSemanticElementsToHide(EObject ctx, Collection<EObject> unfiltered,
+			DSemanticDecorator selection) {
 		List<EObject> filtered = Lists.newArrayList();
 		for (EObject eObject : unfiltered) {
 			if (!(eObject instanceof EParameter)) {
 				filtered.add(eObject);
 			}
 		}
+		if (selection instanceof DEdge && ctx instanceof EClass
+				&& ((DEdge) selection).getActualMapping() instanceof EdgeMapping
+				&& "EC ESupertypes".equals(((EdgeMapping) ((DEdge) selection).getActualMapping()).getName())) {
+			filtered.addAll(((EClass) ctx).getEGenericSuperTypes());
+			for (EGenericType genType : ((EClass) ctx).getEGenericSuperTypes()) {
+				filtered.addAll(genType.getETypeArguments());
+			}
+		}
+
 		return filtered;
 	}