Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2018-12-14 07:51:54 +0000
committerKenn Hussey2019-02-28 21:13:10 +0000
commit7089c75f0e3aab55c6dc2ca380172b388ba7edb7 (patch)
tree6116f3fccde1607bad17ee4fc1d10288acc29893
parentffa6ae73a77fc361df0481e2fb6e6d2412616bca (diff)
downloadorg.eclipse.uml2-7089c75f0e3aab55c6dc2ca380172b388ba7edb7.tar.gz
org.eclipse.uml2-7089c75f0e3aab55c6dc2ca380172b388ba7edb7.tar.xz
org.eclipse.uml2-7089c75f0e3aab55c6dc2ca380172b388ba7edb7.zip
[542789] Optimize stereotype application handling in ElementImpl.eBasicSetContainer()
ElementImpl.eBasicSetContainer() calls ElementOperations.unapplyAllNonApplicableStereotypes(), which can take very long for big models. It appears as if this call isn't needed at all if the oldContainer is null. Change-Id: Ifb64228768118b5aaf65f9e4f6c705492a93e3fe Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=542789 Signed-off-by: Eike Stepper <stepper@esc-net.de>
-rw-r--r--plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java
index f03d632db..be6a6b1fa 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/impl/ElementImpl.java
@@ -895,11 +895,12 @@ public abstract class ElementImpl
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);
@@ -939,15 +940,19 @@ public abstract class ElementImpl
msgs);
}
- if (newContainer != null && (CHANGE_DESCRIPTION_CLASS == null
- || !(CHANGE_DESCRIPTION_CLASS.isInstance(newContainer)))) {
+ if (CHANGE_DESCRIPTION_CLASS == null
+ || !(CHANGE_DESCRIPTION_CLASS.isInstance(newContainer))) {
Resource.Internal eInternalResource = eInternalResource();
-
if (eInternalResource == null || !eInternalResource.isLoading()) {
- ElementOperations.unapplyAllNonApplicableStereotypes(this,
- false);
- ElementOperations.applyAllRequiredStereotypes(this, false);
+
+ if (oldContainer != null) {
+ ElementOperations.unapplyAllNonApplicableStereotypes(this, false);
+ }
+
+ if (newContainer != null) {
+ ElementOperations.applyAllRequiredStereotypes(this, false);
+ }
}
}

Back to the top