diff options
author | Vincent Lorenzo | 2018-10-05 13:52:18 +0000 |
---|---|---|
committer | Patrick Tessier | 2018-10-19 07:44:32 +0000 |
commit | 65a7b3c413b602f2b2eaa40fd7d7b9035f32029f (patch) | |
tree | dc19535b6f04d54c30b804ef5394b606a4652f7f /plugins | |
parent | f349978421af93ea9f27071b92f28daf25753225 (diff) | |
download | org.eclipse.papyrus-65a7b3c413b602f2b2eaa40fd7d7b9035f32029f.tar.gz org.eclipse.papyrus-65a7b3c413b602f2b2eaa40fd7d7b9035f32029f.tar.xz org.eclipse.papyrus-65a7b3c413b602f2b2eaa40fd7d7b9035f32029f.zip |
Bug 530026: [Performance][Stereotype]The way used to name a stereotyped element according to its stereotype is time consuming.
- minor change to continue the improvement
Change-Id: Iee39374487224c626e5da73f80fb3f84b7f6c037
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/uml/org.eclipse.papyrus.uml.types.core/src/org/eclipse/papyrus/uml/types/core/advices/applystereotype/ApplyStereotypeAdviceEditHelperAdvice.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.types.core/src/org/eclipse/papyrus/uml/types/core/advices/applystereotype/ApplyStereotypeAdviceEditHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.types.core/src/org/eclipse/papyrus/uml/types/core/advices/applystereotype/ApplyStereotypeAdviceEditHelperAdvice.java index 326cc6d5c5d..a4db3b5e3cc 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.types.core/src/org/eclipse/papyrus/uml/types/core/advices/applystereotype/ApplyStereotypeAdviceEditHelperAdvice.java +++ b/plugins/uml/org.eclipse.papyrus.uml.types.core/src/org/eclipse/papyrus/uml/types/core/advices/applystereotype/ApplyStereotypeAdviceEditHelperAdvice.java @@ -15,7 +15,6 @@ package org.eclipse.papyrus.uml.types.core.advices.applystereotype; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.eclipse.emf.ecore.EObject; @@ -104,19 +103,22 @@ public class ApplyStereotypeAdviceEditHelperAdvice extends AbstractEditHelperAdv @Override public void configureRequest(final IEditCommandRequest request) { super.configureRequest(request); - StereotypeToApply namingStereotype = null; - final Iterator<StereotypeToApply> iter = this.configuration.getStereotypesToApply().iterator(); + // we go through this method 5 times by stereotyped elements (tested with SysML Block): + // 4 time with a GetEditContextRequest and 1 time with a ConfigureRequest + if (false == request instanceof ConfigureRequest) { + return; + } + + final List<StereotypeToApply> stereotypes = this.configuration.getStereotypesToApply(); // we take the last stereotype for the name, to preserving the previous implementation // we assume that the naming stereotype is applicable to the future created object - while (iter.hasNext()) { - final StereotypeToApply current = iter.next(); + for (int i = stereotypes.size() - 1; i >= 0; i--) { + final StereotypeToApply current = stereotypes.get(i); if (current.isUpdateName()) { - namingStereotype = current; + request.setParameter(RequestParameterConstants.BASE_NAME_TO_SET, NamedElementUtil.getNameFromQualifiedName(current.getStereotypeQualifiedName())); + break; } } - if (null != namingStereotype) { - request.setParameter(RequestParameterConstants.BASE_NAME_TO_SET, NamedElementUtil.getNameFromQualifiedName(namingStereotype.getStereotypeQualifiedName())); - } } /** @@ -213,7 +215,7 @@ public class ApplyStereotypeAdviceEditHelperAdvice extends AbstractEditHelperAdv } Object value = getStereotypeValue(elementToConfigure, stereotype, typedElement.getType(), featureValue); - return service.getEditCommand(new SetStereotypeValueRequest(configureRequest.getEditingDomain(), stereotype, (Element) elementToConfigure, name, value)); + return service.getEditCommand(new SetStereotypeValueRequest(configureRequest.getEditingDomain(), stereotype, elementToConfigure, name, value)); } |