Bug 487500 - [SysML 1.4] Association not always created when creating a
part property in an IBD

 - use a fake true context to fix validation context for UML rules
 (use ConstraintFilter once there is a way to integrate correctly in
Papyrus)
 - add instanceof in ModelConstraint to avoid ClassCastException
 - deprecate useless selector
 - swith test for performances (test UML before stereotypes)
 - fix some quality bugs 

Change-Id: I4de3a3f5ff4d5168d710608ca75908e8c351f154
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
diff --git a/core/org.eclipse.papyrus.sysml14.validation/plugin.xml b/core/org.eclipse.papyrus.sysml14.validation/plugin.xml
index 00b8a9e..b41e825 100644
--- a/core/org.eclipse.papyrus.sysml14.validation/plugin.xml
+++ b/core/org.eclipse.papyrus.sysml14.validation/plugin.xml
@@ -546,6 +546,15 @@
    </extension>
    <extension name="org.eclipse.papyrus.sysml14.validation.constraintBindings" point="org.eclipse.emf.validation.constraintBindings">
       
+      <!-- UML fake context (should be replaced by filter see Bug 487500)-->
+      <clientContext id="TrueContext">
+         <selector class="org.eclipse.papyrus.sysml14.validation.selectors.TrueSelector"/>
+      </clientContext>
+      <binding context="TrueContext">
+         <constraint ref="org.eclipse.papyrus.sysml14.validation.constraint.block.property.asssociationend"/>
+         <constraint ref="org.eclipse.papyrus.sysml14.validation.constraint.block.associationBlock"/>
+      </binding>  
+       
       <!-- Requirement Context -->
       <clientContext id="CopyClientContext">
          <selector class="org.eclipse.papyrus.sysml14.validation.selectors.CopySelector"/>
@@ -608,12 +617,7 @@
       </binding>           
       
       <!-- Blocks context -->
-      <clientContext id="AssociationContext">
-         <selector class="org.eclipse.papyrus.sysml14.validation.selectors.AssociationSelector"/>
-      </clientContext>
-      <binding context="AssociationContext">
-         <constraint ref="org.eclipse.papyrus.sysml14.validation.constraint.block.associationBlock"/>
-      </binding>     
+  
       <clientContext id="DirectedRelationshipPropertyPathContext">
          <selector class="org.eclipse.papyrus.sysml14.validation.selectors.DirectedRelationshipPropertyPathSelector"/>
       </clientContext>
@@ -636,12 +640,7 @@
          <constraint ref="org.eclipse.papyrus.sysml14.validation.constraint.block.specialization"/>
       </binding>             
  
-      <clientContext id="PropertyContext">
-         <selector class="org.eclipse.papyrus.sysml14.validation.selectors.PropertySelector"/>
-      </clientContext>
-      <binding context="PropertyContext">
-         <constraint ref="org.eclipse.papyrus.sysml14.validation.constraint.block.property.asssociationend"/>
-      </binding>  
+
       
       <clientContext id="ElementPropertyPathContext">
          <selector class="org.eclipse.papyrus.sysml14.validation.selectors.ElementPropertyPathSelector"/>
diff --git a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/rules/blocks/AssociationBlockModelConstraint.java b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/rules/blocks/AssociationBlockModelConstraint.java
index d6e067c..93e43d5 100644
--- a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/rules/blocks/AssociationBlockModelConstraint.java
+++ b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/rules/blocks/AssociationBlockModelConstraint.java
@@ -14,6 +14,7 @@
 
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.validation.AbstractModelConstraint;
 import org.eclipse.emf.validation.IValidationContext;
 import org.eclipse.papyrus.sysml14.blocks.Block;
@@ -37,19 +38,22 @@
 	 */
 	@Override
 	public IStatus validate(IValidationContext context) {
-		Association association = (Association) context.getTarget();
-		EList<Property> memberEnds = association.getMemberEnds();
-		if (memberEnds != null && memberEnds.size() >= 2) {
-			Property firstProperty = memberEnds.get(0);
-			Property secondProperty = memberEnds.get(1);
-			if (firstProperty != null && secondProperty != null) {
-				Type firstType = firstProperty.getType();
-				Type secondType = secondProperty.getType();
-				if (firstType != null && secondType != null) {
-					if (UMLUtil.getStereotypeApplication(firstType, Block.class) != null
-							&& UMLUtil.getStereotypeApplication(secondType, Block.class) != null) {
+		EObject target = context.getTarget();
+		if (target instanceof Association) {
+			Association association = (Association) target;
+			EList<Property> memberEnds = association.getMemberEnds();
+			if (memberEnds != null && memberEnds.size() >= 2) {
+				Property firstProperty = memberEnds.get(0);
+				Property secondProperty = memberEnds.get(1);
+				if (firstProperty != null && secondProperty != null) {
+					Type firstType = firstProperty.getType();
+					Type secondType = secondProperty.getType();
+					if (firstType != null && secondType != null) {
 						if (memberEnds.size() != 2) {
-							return context.createFailureStatus(context.getTarget());
+							if (UMLUtil.getStereotypeApplication(firstType, Block.class) != null
+								&& UMLUtil.getStereotypeApplication(secondType, Block.class) != null) {
+								return context.createFailureStatus(target);
+							}
 						}
 					}
 				}
diff --git a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/rules/blocks/BlockPropertyAssociationEndModelConstraint.java b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/rules/blocks/BlockPropertyAssociationEndModelConstraint.java
index c0278f1..994981c 100644
--- a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/rules/blocks/BlockPropertyAssociationEndModelConstraint.java
+++ b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/rules/blocks/BlockPropertyAssociationEndModelConstraint.java
@@ -13,6 +13,7 @@
 package org.eclipse.papyrus.sysml14.validation.rules.blocks;
 
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.validation.AbstractModelConstraint;
 import org.eclipse.emf.validation.IValidationContext;
 import org.eclipse.papyrus.sysml14.blocks.Block;
@@ -38,12 +39,15 @@
 	 */
 	@Override
 	public IStatus validate(IValidationContext context) {
-		Property property = (Property) context.getTarget();
-		Type type = property.getType();
-		if (type != null) {
-			if (UMLUtil.getStereotypeApplication(type, Block.class) != null) {
+		EObject target = context.getTarget();
+		if (target instanceof Property){
+			Property property = (Property) target;
+			Type type = property.getType();
+			if (type != null) {
 				if (property.getAssociation() == null) {
-					return context.createFailureStatus(context.getTarget());
+					if (UMLUtil.getStereotypeApplication(type, Block.class) != null) {
+						return context.createFailureStatus(target);
+					}
 				}
 			}
 		}
diff --git a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/AssociationSelector.java b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/AssociationSelector.java
index 7c9da61..a00cacb 100644
--- a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/AssociationSelector.java
+++ b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/AssociationSelector.java
@@ -15,6 +15,11 @@
 import org.eclipse.emf.validation.model.IClientSelector;
 import org.eclipse.uml2.uml.Association;
 
+
+/**
+ *@deprecated
+ */
+@Deprecated // since 0.10.1 to remove in 0.11.0
 public class AssociationSelector implements IClientSelector {
 
 	@Override
diff --git a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/PropertySelector.java b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/PropertySelector.java
index aba58b5..eaa7ce9 100644
--- a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/PropertySelector.java
+++ b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/PropertySelector.java
@@ -15,8 +15,14 @@
 import org.eclipse.emf.validation.model.IClientSelector;
 import org.eclipse.uml2.uml.Property;
 
+
+/**
+ *@deprecated
+ */
+@Deprecated // since 0.10.1 to remove in 0.11.0
 public class PropertySelector implements IClientSelector {
 
+	@Override
 	public boolean selects(Object object) {
 		return object instanceof Property;
 	}
diff --git a/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/TrueSelector.java b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/TrueSelector.java
new file mode 100644
index 0000000..26e0e42
--- /dev/null
+++ b/core/org.eclipse.papyrus.sysml14.validation/src/org/eclipse/papyrus/sysml14/validation/selectors/TrueSelector.java
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *   
+ *****************************************************************************/
+package org.eclipse.papyrus.sysml14.validation.selectors;
+
+import org.eclipse.emf.validation.model.IClientSelector;
+
+
+
+/**
+ * Temporary solution to execute validation on uml context
+ * @deprecated
+ */
+@Deprecated // to remove once Bug 507734 is solved
+public class TrueSelector implements IClientSelector {
+
+	@Override
+	public boolean selects(Object object) {
+		return true;
+	}
+}
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/blocks/BlockCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/blocks/BlockCustomImpl.java
index 9fdf346..df94081 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/blocks/BlockCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/blocks/BlockCustomImpl.java
@@ -36,7 +36,7 @@
 	 */
 	@Override
 	public EList<Property> getReferences() { 
-		BasicEList<Property> propertyEList = new BasicEList<Property>();
+		BasicEList<Property> propertyEList = new BasicEList<>();
 	
 		if (getBase_Class() != null) {
 			EList<Property> ownedAttributes = getBase_Class().getOwnedAttributes(); 
@@ -51,7 +51,7 @@
 			}
 		}
 
-		return new BasicEList.UnmodifiableEList<Property>(propertyEList.size(), propertyEList.toArray());
+		return new BasicEList.UnmodifiableEList<>(propertyEList.size(), propertyEList.toArray());
 	}
 	
 	/**
@@ -62,7 +62,7 @@
 	 */
 	@Override
 	public EList<Property> getParts() { 
-		BasicEList<Property> propertyEList = new BasicEList<Property>();
+		BasicEList<Property> propertyEList = new BasicEList<>();
 	
 		if (getBase_Class() != null) {
 			EList<Property> ownedAttributes = getBase_Class().getOwnedAttributes(); 
@@ -77,7 +77,7 @@
 			}
 		}
 
-		return new BasicEList.UnmodifiableEList<Property>(propertyEList.size(), propertyEList.toArray());
+		return new BasicEList.UnmodifiableEList<>(propertyEList.size(), propertyEList.toArray());
 	}
 	
 	/**
@@ -89,7 +89,7 @@
 	 */
 	@Override
 	public EList<Property> getFlowProperties() { 
-		BasicEList<Property> propertyEList = new BasicEList<Property>();
+		BasicEList<Property> propertyEList = new BasicEList<>();
 	
 		if (getBase_Class() != null) {
 			EList<Property> ownedAttributes = getBase_Class().getOwnedAttributes(); 
@@ -101,7 +101,7 @@
 			}
 		}
 
-		return new BasicEList.UnmodifiableEList<Property>(propertyEList.size(), propertyEList.toArray());
+		return new BasicEList.UnmodifiableEList<>(propertyEList.size(), propertyEList.toArray());
 	}
 	
 }
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/blocks/BoundReferenceCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/blocks/BoundReferenceCustomImpl.java
index 2d4fa44..17b4281 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/blocks/BoundReferenceCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/blocks/BoundReferenceCustomImpl.java
@@ -40,7 +40,7 @@
 	 */
 	@Override
 	public EList<Property> getBindingPath() { 
-		BasicEList<Property> propertyEList = new BasicEList<Property>();
+		BasicEList<Property> propertyEList = new BasicEList<>();
 		ConnectorEnd connectorEnd = getBoundEnd();
 		if (connectorEnd != null){
 			NestedConnectorEnd nestedConnectorEnd = UMLUtil.getStereotypeApplication(connectorEnd, NestedConnectorEnd.class);
@@ -54,7 +54,7 @@
 				propertyEList.add((Property) role);
 			}
 		}
-		return new UnmodifiableEList<Property>(this, BlocksPackage.eINSTANCE.getBoundReference_BindingPath(), propertyEList.size(), propertyEList.toArray());
+		return new UnmodifiableEList<>(this, BlocksPackage.eINSTANCE.getBoundReference_BindingPath(), propertyEList.size(), propertyEList.toArray());
 	}
 	
 }
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/constraintblocks/ConstraintBlockCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/constraintblocks/ConstraintBlockCustomImpl.java
index 07ed7ef..5062046 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/constraintblocks/ConstraintBlockCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/constraintblocks/ConstraintBlockCustomImpl.java
@@ -35,7 +35,7 @@
 	 */
 	@Override
 	public EList<Property> getParameters() { 
-		BasicEList<Property> propertyEList = new BasicEList<Property>();
+		BasicEList<Property> propertyEList = new BasicEList<>();
 	
 		if (getBase_Class() != null) {
 			EList<Property> ownedAttributes = getBase_Class().getOwnedAttributes(); 
@@ -48,7 +48,7 @@
 			}
 		}
 
-		return new BasicEList.UnmodifiableEList<Property>(propertyEList.size(), propertyEList.toArray());
+		return new BasicEList.UnmodifiableEList<>(propertyEList.size(), propertyEList.toArray());
 	}
 	
 }
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/deprecatedelements/FlowSpecificationCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/deprecatedelements/FlowSpecificationCustomImpl.java
index f68e04a..c2b62c7 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/deprecatedelements/FlowSpecificationCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/deprecatedelements/FlowSpecificationCustomImpl.java
@@ -29,13 +29,12 @@
 	/**
 	 * 
 	 * @see org.eclipse.papyrus.sysml14.blocks.internal.impl.FlowSpecificationImpl#getFlowProperties()
-	 * @pap.req org.eclipse.papyrus.sysml14#REQ-XXX
 	 *
 	 * @return the list of FlowProperties
 	 */
 	@Override
 	public EList<Property> getFlowProperties() { 
-		BasicEList<Property> propertyEList = new BasicEList<Property>();
+		BasicEList<Property> propertyEList = new BasicEList<>();
 	
 		if (getBase_Interface() != null) {
 			EList<Property> ownedAttributes = getBase_Interface().getOwnedAttributes(); 
@@ -47,7 +46,7 @@
 			}
 		}
 
-		return new BasicEList.UnmodifiableEList<Property>(propertyEList.size(), propertyEList.toArray());
+		return new BasicEList.UnmodifiableEList<>(propertyEList.size(), propertyEList.toArray());
 	}
 	
 }
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ElementGroupCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ElementGroupCustomImpl.java
index 4cb185d..2928d00 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ElementGroupCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ElementGroupCustomImpl.java
@@ -37,6 +37,7 @@
 	 *<p> See the requirement <b>{@papyrus.req org.eclipse.papyrus.sysml14#Req014}</b>. 
 	 * @return
 	 */
+	@Override
 	public String getCriterion() {
 		String criterion = ""; //$NON-NLS-1$
 		Comment comment = getBase_Comment();
@@ -72,13 +73,14 @@
 	 *
 	 * @return
 	 */
+	@Override
 	public EList<Element> getMember() {
-		BasicEList<Element> elementEList = new BasicEList<Element>();
+		BasicEList<Element> elementEList = new BasicEList<>();
 		Comment comment = getBase_Comment();
 		if (comment != null){
 			elementEList.addAll( comment.getAnnotatedElements());
 		}	
-		return new UnmodifiableEList<Element>(this, ModelelementsPackage.eINSTANCE.getElementGroup_Member(), elementEList.size(), elementEList.toArray());
+		return new UnmodifiableEList<>(this, ModelelementsPackage.eINSTANCE.getElementGroup_Member(), elementEList.size(), elementEList.toArray());
 	}
 	
 	/**
@@ -87,6 +89,7 @@
 	 *
 	 * @return
 	 */
+	@Override
 	public int getSize() {
 		return getMember().size();
 	}	
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/StakeholderCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/StakeholderCustomImpl.java
index d9bc7e3..b3577ab 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/StakeholderCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/StakeholderCustomImpl.java
@@ -33,9 +33,9 @@
 	 */
 	@Override
 	public EList<String> getConcern() {
-		EList<String> concern = new BasicEList<String>();
+		EList<String> concern = new BasicEList<>();
 		 EList<Comment> commentEList = getConcernList();
-		 if (commentEList!=null && commentEList.size() > 0){ 
+		 if (commentEList!=null && !commentEList.isEmpty()){ 
 			 for (Comment comment : commentEList) {
 				 String body = comment.getBody();
 				 if (body != null){
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ViewCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ViewCustomImpl.java
index f5b07ff..01f6adb 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ViewCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ViewCustomImpl.java
@@ -80,12 +80,12 @@
 	 */
 	@Override
 	public EList<Stakeholder> getStakeholder() {
-		EList<Stakeholder> stakeholderEList = new BasicEList<Stakeholder>();
+		EList<Stakeholder> stakeholderEList = new BasicEList<>();
 		Viewpoint viewPoint = getViewPoint();
 		if (viewPoint != null){
 			stakeholderEList.addAll(viewPoint.getStakeholder());
 		}
-		return new UnmodifiableEList<Stakeholder>(this, ModelelementsPackage.eINSTANCE.getViewpoint_Stakeholder(), stakeholderEList.size(), stakeholderEList.toArray());
+		return new UnmodifiableEList<>(this, ModelelementsPackage.eINSTANCE.getViewpoint_Stakeholder(), stakeholderEList.size(), stakeholderEList.toArray());
 	}
 	
 	
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ViewpointCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ViewpointCustomImpl.java
index 9145bb0..6496f2d 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ViewpointCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/modelelements/ViewpointCustomImpl.java
@@ -39,8 +39,9 @@
 	 *<p> See the requirement <b>{@papyrus.req org.eclipse.papyrus.sysml14#Req013}</b>. 
 	 * @return
 	 */
+	@Override
 	public EList<Behavior> getMethod() {
-		EList<Behavior> behaviorEList = new BasicEList<Behavior>();
+		EList<Behavior> behaviorEList = new BasicEList<>();
 		Class clazz = getBase_Class();
 		if (clazz != null) {
 			EList<Operation> operations = clazz.getOperations();
@@ -48,7 +49,7 @@
 				Iterator<Operation> it = operations.iterator();
 
 				while (it.hasNext()) {
-					Operation operation = (Operation) it.next();
+					Operation operation = it.next();
 					Create create = UMLUtil.getStereotypeApplication(operation, Create.class);
 					if (create != null) {
 						behaviorEList.addAll(operation.getMethods());
@@ -57,7 +58,7 @@
 				}
 			}
 		}
-		return new UnmodifiableEList<Behavior>(this, ModelelementsPackage.eINSTANCE.getViewpoint_Method(), behaviorEList.size(), behaviorEList.toArray());
+		return new UnmodifiableEList<>(this, ModelelementsPackage.eINSTANCE.getViewpoint_Method(), behaviorEList.size(), behaviorEList.toArray());
 	}
 
 	/**
@@ -69,7 +70,7 @@
 	 */
 	@Override
 	public EList<String> getConcern() {
-		EList<String> concernEList = new BasicEList<String>();
+		EList<String> concernEList = new BasicEList<>();
 		EList<Comment> theConcernList = getConcernList();
 		for (Comment comment : theConcernList) {
 			String body = comment.getBody();
diff --git a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/requirements/RequirementCustomImpl.java b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/requirements/RequirementCustomImpl.java
index 36591a9..dca83cf 100644
--- a/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/requirements/RequirementCustomImpl.java
+++ b/core/org.eclipse.papyrus.sysml14/src/org/eclipse/papyrus/sysml14/requirements/RequirementCustomImpl.java
@@ -51,15 +51,13 @@
 		// current
 		// This should return the TestCase verifying current Requirement
 		Requirement master = null;
-		Copy currentCopy = null;
-
 		if (getBase_Class() != null) {
 			Iterator<Dependency> itDep = getBase_Class().getClientDependencies().iterator();
 
 			// Find Copy link
 			while (itDep.hasNext()) {
 				Dependency currentDep = itDep.next();
-				currentCopy = UMLUtil.getStereotypeApplication(currentDep, Copy.class);
+				Copy currentCopy = UMLUtil.getStereotypeApplication(currentDep, Copy.class);
 
 				if (currentCopy != null) {
 					EList<NamedElement> suppliers = currentCopy.getBase_Abstraction().getSuppliers();
@@ -89,16 +87,14 @@
 	@Override
 	public EList<Requirement> getDerived() {
 		// This should return the Requirement(s) derived from current
-		EList<Requirement> derived = new BasicEList<Requirement>();
-		DeriveReqt currentDeriveReqt = null;
-
+		EList<Requirement> derived = new BasicEList<>();
 		if (getBase_Class() != null) {
 			Iterator<DirectedRelationship> itDep = getBase_Class().getTargetDirectedRelationships().iterator();
 
 			// Find DeriveReqt link
 			while (itDep.hasNext()) {
 				DirectedRelationship currentDirectedRelationship = itDep.next();
-				currentDeriveReqt = UMLUtil.getStereotypeApplication(currentDirectedRelationship, DeriveReqt.class);
+				DeriveReqt currentDeriveReqt = UMLUtil.getStereotypeApplication(currentDirectedRelationship, DeriveReqt.class);
 
 				if (currentDeriveReqt != null) {
 					EList<NamedElement> clients = currentDeriveReqt.getBase_Abstraction().getClients();
@@ -113,7 +109,7 @@
 			}
 		}
 
-		return new UnmodifiableEList<Requirement>(this, RequirementsPackage.eINSTANCE.getRequirement_Derived(), derived.size(), derived.toArray());
+		return new UnmodifiableEList<>(this, RequirementsPackage.eINSTANCE.getRequirement_Derived(), derived.size(), derived.toArray());
 	}
 
 	/**
@@ -128,15 +124,14 @@
 	public EList<Requirement> getDerivedFrom() {
 		// This should return the Requirement(s) this Requirement is derived
 		// from
-		EList<Requirement> derivedFrom = new BasicEList<Requirement>();
-		DeriveReqt currentDeriveReqt = null;
+		EList<Requirement> derivedFrom = new BasicEList<>();
 		if (getBase_Class() != null) {
 			Iterator<DirectedRelationship> itDep = getBase_Class().getSourceDirectedRelationships().iterator();
 
 			// Find DeriveReqt link
 			while (itDep.hasNext()) {
 				DirectedRelationship currentDRelationship = itDep.next();
-				currentDeriveReqt = UMLUtil.getStereotypeApplication(currentDRelationship, DeriveReqt.class);
+				DeriveReqt currentDeriveReqt = UMLUtil.getStereotypeApplication(currentDRelationship, DeriveReqt.class);
 
 				if (currentDeriveReqt != null) {
 					EList<NamedElement> suppliers = currentDeriveReqt.getBase_Abstraction().getSuppliers();
@@ -151,7 +146,7 @@
 			}
 		}
 
-		return new UnmodifiableEList<Requirement>(this, RequirementsPackage.eINSTANCE.getRequirement_DerivedFrom(), derivedFrom.size(), derivedFrom.toArray());
+		return new UnmodifiableEList<>(this, RequirementsPackage.eINSTANCE.getRequirement_DerivedFrom(), derivedFrom.size(), derivedFrom.toArray());
 	}
 
 
@@ -167,16 +162,14 @@
 	public EList<NamedElement> getRefinedBy() {
 		// This should return the NamedElement(s) that refine current
 		// Requirement
-		EList<NamedElement> refinedBy = new BasicEList<NamedElement>();
-		Refine currentRefine = null;
-
+		EList<NamedElement> refinedBy = new BasicEList<>();
 		if (getBase_Class() != null) {
 			Iterator<DirectedRelationship> itDep = getBase_Class().getTargetDirectedRelationships().iterator();
 
 			// Find Refine link
 			while (itDep.hasNext()) {
 				DirectedRelationship currentDRelationship = itDep.next();
-				currentRefine = UMLUtil.getStereotypeApplication(currentDRelationship, Refine.class);
+				Refine currentRefine = UMLUtil.getStereotypeApplication(currentDRelationship, Refine.class);
 
 				if (currentRefine != null) {
 					refinedBy.addAll(currentRefine.getBase_Abstraction().getClients());
@@ -184,7 +177,7 @@
 			}
 		}
 
-		return new UnmodifiableEList<NamedElement>(this, RequirementsPackage.eINSTANCE.getRequirement_RefinedBy(), refinedBy.size(), refinedBy.toArray());
+		return new UnmodifiableEList<>(this, RequirementsPackage.eINSTANCE.getRequirement_RefinedBy(), refinedBy.size(), refinedBy.toArray());
 	}
 
 	
@@ -201,16 +194,14 @@
 	public EList<NamedElement> getSatisfiedBy() {
 		// This should return the NamedElement(s) that satisfy current
 		// Requirement
-		EList<NamedElement> satisfyBy = new BasicEList<NamedElement>();
-		Satisfy currentSatisfy = null;
-
+		EList<NamedElement> satisfyBy = new BasicEList<>();
 		if (getBase_Class() != null) {
 			Iterator<DirectedRelationship> itDep = getBase_Class().getTargetDirectedRelationships().iterator();
 
 			// Find Satisfy link
 			while (itDep.hasNext()) {
 				DirectedRelationship currentDRelationship = itDep.next();
-				currentSatisfy = UMLUtil.getStereotypeApplication(currentDRelationship, Satisfy.class);
+				Satisfy currentSatisfy = UMLUtil.getStereotypeApplication(currentDRelationship, Satisfy.class);
 
 				if (currentSatisfy != null) {
 					satisfyBy.addAll(currentSatisfy.getBase_Abstraction().getClients());
@@ -218,7 +209,7 @@
 			}
 		}
 
-		return new UnmodifiableEList<NamedElement>(this, RequirementsPackage.eINSTANCE.getRequirement_SatisfiedBy(), satisfyBy.size(), satisfyBy.toArray());
+		return new UnmodifiableEList<>(this, RequirementsPackage.eINSTANCE.getRequirement_SatisfiedBy(), satisfyBy.size(), satisfyBy.toArray());
 	}
 
 
@@ -236,16 +227,14 @@
 		// SysML spec. : Derived from all elements that are the client of a
 		// <<trace>> relationship
 		// for which this requirement is a supplier.
-		EList<NamedElement> tracedTo = new BasicEList<NamedElement>();
-		Trace currentTrace = null;
-
+		EList<NamedElement> tracedTo = new BasicEList<>();
 		if (getBase_Class() != null) {
 			Iterator<DirectedRelationship> itDep = getBase_Class().getTargetDirectedRelationships().iterator();
 
 			// Find Trace link
 			while (itDep.hasNext()) {
 				DirectedRelationship currentDR = itDep.next();
-				currentTrace = UMLUtil.getStereotypeApplication(currentDR, Trace.class);
+				Trace currentTrace = UMLUtil.getStereotypeApplication(currentDR, Trace.class);
 
 				// Must be a Trace not a subtype (see bug #352563).
 				if (currentTrace != null && currentTrace.eClass() == RequirementsPackage.eINSTANCE.getTrace()) {
@@ -255,7 +244,7 @@
 			}
 		}
 
-		return new UnmodifiableEList<NamedElement>(this, RequirementsPackage.eINSTANCE.getRequirement_TracedTo(), tracedTo.size(), tracedTo.toArray());
+		return new UnmodifiableEList<>(this, RequirementsPackage.eINSTANCE.getRequirement_TracedTo(), tracedTo.size(), tracedTo.toArray());
 	}
 
 	
@@ -271,23 +260,21 @@
 	public EList<NamedElement> getVerifiedBy() {
 		// This should return the list of NamedElement verifying current
 		// Requirement
-		EList<NamedElement> verifiedBy = new BasicEList<NamedElement>();
-		Verify currentVerify = null;
-
+		EList<NamedElement> verifiedBy = new BasicEList<>();
 		if (getBase_Class() != null) {
 			Iterator<DirectedRelationship> itDep = getBase_Class().getTargetDirectedRelationships().iterator();
 
 			// Find Verify link
 			while (itDep.hasNext()) {
 				DirectedRelationship currentDRelationship = itDep.next();
-				currentVerify = UMLUtil.getStereotypeApplication(currentDRelationship, Verify.class);
+				Verify currentVerify = UMLUtil.getStereotypeApplication(currentDRelationship, Verify.class);
 
 				if (currentVerify != null) {
 					verifiedBy.addAll(currentVerify.getBase_Abstraction().getClients());
 				}
 			}
 		}
-		return new UnmodifiableEList<NamedElement>(this, RequirementsPackage.eINSTANCE.getRequirement_VerifiedBy(), verifiedBy.size(), verifiedBy.toArray());
+		return new UnmodifiableEList<>(this, RequirementsPackage.eINSTANCE.getRequirement_VerifiedBy(), verifiedBy.size(), verifiedBy.toArray());
 	}
 
 } 
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/configuration/blockDefinitionDiagramConfig.expansionmodel b/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/configuration/blockDefinitionDiagramConfig.expansionmodel
index c3e6295..a3635b2 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/configuration/blockDefinitionDiagramConfig.expansionmodel
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/configuration/blockDefinitionDiagramConfig.expansionmodel
@@ -4,7 +4,7 @@
     <gmftRepresentations xmi:id="_rC19oNnoEeSqwOe5_frWm2" editPartQualifiedName="org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ClassEditPart" name="Block based on Class representation of class diagram" viewFactory="org.eclipse.papyrus.sysml14.diagram.blockdefinition.internal.factory.BlockClassifierViewFactory" inducedRepresentations="_rC19oNnoEeSqwOe5_frWm6 _CvPDslVqEeW77p7V_ZuW3Q _rC19oNnoEeSqwOe5_frWm7 _CvPDs1VqEeW77p7V_ZuW3Q _CvPDtFVqEeW77p7V_ZuW3Q _CvPDtVVqEeW77p7V_ZuW3Q _CSMSEGFBEeWbSMDuSXx8SQ _59LCcACiEeabH6-I0dvpUQ" subRepresentations="_CvN1kVVqEeW77p7V_ZuW3Q _CvOcoVVqEeW77p7V_ZuW3Q _CvOcolVqEeW77p7V_ZuW3Q _CvOco1VqEeW77p7V_ZuW3Q" reusedID="Class_Shape"/>
     <gmftRepresentations xmi:id="_dq31kGdDEeW5JrLha2pcnA" editPartQualifiedName="org.eclipse.papyrus.uml.diagram.clazz.edit.parts.InterfaceEditPart" name="FlowSpecification based on Interface representation of class diagram" viewFactory="org.eclipse.papyrus.sysml14.diagram.blockdefinition.internal.factory.FlowSpecificationClassifierViewFactory" graphicalElementType="" inducedRepresentations="_CSMSEGFBEeWbSMDuSXx8SQ" subRepresentations="_CvN1kVVqEeW77p7V_ZuW3Q" reusedID="Interface_Shape"/>
   </usages>
-  <libraries xmi:id="_rC19oNnoEeSqwOe5_frWm3" name="Independant Representations">
+  <libraries xmi:id="_rC19oNnoEeSqwOe5_frWm3" name="Independent Representations">
     <representations xsi:type="expansionmodel:Representation" xmi:id="_rC19oNnoEeSqwOe5_frWm4" editPartQualifiedName="org.eclipse.papyrus.uml.diagram.clazz.edit.parts.PropertyForClassEditPart" name="Flow Port As Label" viewFactory="org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.ShapeViewFactory" graphicalElementType="org.eclipse.papyrus.sysmldi.FlowPort_Label"/>
     <representations xsi:type="expansionmodel:Representation" xmi:id="_CvN1kFVqEeW77p7V_ZuW3Q" editPartQualifiedName="org.eclipse.papyrus.uml.diagram.clazz.edit.parts.DependencyEditPart" name="Verify Link" viewFactory="org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.ConnectorViewFactory" graphicalElementType="org.eclipse.papyrus.sysmldi.Verify_Abstraction_Verify_Link"/>
     <representations xsi:type="expansionmodel:Representation" xmi:id="_CvN1kVVqEeW77p7V_ZuW3Q" name="Operation Border Item" viewFactory="org.eclipse.papyrus.sysml14.diagram.blockdefinition.internal.factory.OperationPortViewFactory" graphicalElementType="org.eclipse.papyrus.sysmldi." inducedRepresentations="_CvPDsVVqEeW77p7V_ZuW3Q _CvPDsFVqEeW77p7V_ZuW3Q">
diff --git a/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/resources/configuration/internaBlockDiagramConfig.expansionmodel b/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/resources/configuration/internaBlockDiagramConfig.expansionmodel
index a9acc27..6e25707 100644
--- a/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/resources/configuration/internaBlockDiagramConfig.expansionmodel
+++ b/diagram/org.eclipse.papyrus.sysml14.diagram.internalblock/resources/configuration/internaBlockDiagramConfig.expansionmodel
@@ -5,7 +5,7 @@
     <gmftRepresentations xmi:id="_j7dP0HytEeWustL01XNGSA" editPartQualifiedName="org.eclipse.papyrus.sysml14.diagram.common.edit.parts.SysMLConnectorEditPart" name="SysmlConnector based on Composite Connector @papyrus.req org.eclipse.papyrus.sysml14.diagram.internalblock#Req_004" viewFactory="org.eclipse.papyrus.sysml14.diagram.common.internal.factory.SysMLConnectorViewFactory" subRepresentations="_EDXlcHzEEeWVMv-LGO6tZw" reusedID="Connector_Edge"/>
     <gmftRepresentations xmi:id="_EDXlcHzEEeWVMv-LGO6tZw" editPartQualifiedName="org.eclipse.papyrus.sysml14.diagram.common.edit.parts.SysMLConnectorAppliedStereotypeEditPart" name="Applied Stereotype label for a connector  @papyrus.req org.eclipse.papyrus.sysml14.diagram.internalblock#Req_004" viewFactory="org.eclipse.gmf.runtime.diagram.ui.view.factories.optimal.DecorationNodeViewFactory" reusedID="6025"/>
   </usages>
-  <libraries xmi:id="_rC19oNnoEeSqwOe5_frWm3" name="Independant Representations">
+  <libraries xmi:id="_rC19oNnoEeSqwOe5_frWm3" name="Independent Representations">
     <representations xsi:type="expansionmodel:Representation" xmi:id="_rC19oNnoEeSqwOe5_frWm4" editPartQualifiedName="org.eclipse.papyrus.sysml14.diagram.common.edit.parts.FlowPortEditPart" name="Flow Port As Icon" viewFactory="org.eclipse.papyrus.sysml14.diagram.common.internal.factory.FlowPortViewFactory" graphicalElementType="org.eclipse.papyrus.sysmldi.FlowPort_Icon"/>
   </libraries>
 </expansionmodel:DiagramExpansion>
diff --git a/table/org.eclipse.papyrus.sysml14.nattable.common/src/org/eclipse/papyrus/sysml14/nattable/common/provider/SysMLFlowPortDirectionLabelProvider.java b/table/org.eclipse.papyrus.sysml14.nattable.common/src/org/eclipse/papyrus/sysml14/nattable/common/provider/SysMLFlowPortDirectionLabelProvider.java
index 54a04a1..f754e8e 100644
--- a/table/org.eclipse.papyrus.sysml14.nattable.common/src/org/eclipse/papyrus/sysml14/nattable/common/provider/SysMLFlowPortDirectionLabelProvider.java
+++ b/table/org.eclipse.papyrus.sysml14.nattable.common/src/org/eclipse/papyrus/sysml14/nattable/common/provider/SysMLFlowPortDirectionLabelProvider.java
@@ -62,7 +62,7 @@
 
 	@Override
 	public String getText(Object element) {
-		final ILayerCell cell = ((LabelProviderCellContextElementWrapper) element);
+		final ILayerCell cell = (LabelProviderCellContextElementWrapper) element;
 		final IConfigRegistry configRegistry = ((LabelProviderCellContextElementWrapper) element).getConfigRegistry();
 		final Object rowObject = getRowObject(cell, configRegistry);
 		final Object columObject = getColumnObject(cell, configRegistry);