Bug 568396 - [UML][CDO] UML CDO implementation lose stereotype
application

Realign org.eclipse.uml2.uml.internal.impl.ElementImpl.eBasicSetContainer(InternalEObject,
int, NotificationChain) with the latest UML2 5.5.0 implementation.

Change-Id: I7f90e9d5aeee8ea588812cce1b26a907e58a39e9
diff --git a/cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/impl/ElementImpl.java b/cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/impl/ElementImpl.java
index 6c780a2..01c273e 100644
--- a/cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/impl/ElementImpl.java
+++ b/cdo/bundles/uml/org.eclipse.uml2.uml.cdo/src/org/eclipse/uml2/uml/cdo/internal/impl/ElementImpl.java
@@ -900,12 +900,11 @@
 	public NotificationChain eBasicSetContainer(InternalEObject newContainer,
 			int newContainerFeatureID, NotificationChain msgs) {
 
-		InternalEObject oldContainer = eInternalContainer();
-		
 		if (eDirectResource() != null && newContainer != null
 			&& eContainmentFeature(this, newContainer,
 				newContainerFeatureID) == null) {
 
+			InternalEObject oldContainer = eInternalContainer();
 			int oldContainerFeatureID = eContainerFeatureID();
 
 			eBasicSetContainer(newContainer, newContainerFeatureID);
@@ -945,19 +944,15 @@
 				msgs);
 		}
 
-		if (CHANGE_DESCRIPTION_CLASS == null
-			|| !(CHANGE_DESCRIPTION_CLASS.isInstance(newContainer))) {
+		if (newContainer != null && (CHANGE_DESCRIPTION_CLASS == null
+			|| !(CHANGE_DESCRIPTION_CLASS.isInstance(newContainer)))) {
 
 			Resource.Internal eInternalResource = eInternalResource();
-			if (eInternalResource == null || !eInternalResource.isLoading()) {
 
-				if (oldContainer != null) {
-					ElementOperations.unapplyAllNonApplicableStereotypes(this, false);
-				}
-				
-				if (newContainer != null) {
-					ElementOperations.applyAllRequiredStereotypes(this, false);
-				}
+			if (eInternalResource == null || !eInternalResource.isLoading()) {
+				ElementOperations.unapplyAllNonApplicableStereotypes(this,
+					false);
+				ElementOperations.applyAllRequiredStereotypes(this, false);
 			}
 		}