Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2016-10-14 08:31:43 +0000
committerGerrit Code Review @ Eclipse.org2016-10-17 19:29:25 +0000
commit30b6e9ae38a7852db9f7e397ba5c32f66c48ff94 (patch)
tree3c30a63b42a997d666e019c53c99d381ee2e7457
parent3ab72fb57be79dfa1d8153f3d03001ac1c9998ca (diff)
downloadorg.eclipse.papyrus-30b6e9ae38a7852db9f7e397ba5c32f66c48ff94.tar.gz
org.eclipse.papyrus-30b6e9ae38a7852db9f7e397ba5c32f66c48ff94.tar.xz
org.eclipse.papyrus-30b6e9ae38a7852db9f7e397ba5c32f66c48ff94.zip
bug 505947: [Table] Improve the method AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager.initializeManagedObjectList()
Change-Id: I4afce218b2207b5565e6d7e1d51a5813e6da7e11 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager.java46
1 files changed, 22 insertions, 24 deletions
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager.java
index 90aa7d2de67..45be4b2110d 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager.java
@@ -62,6 +62,17 @@ public abstract class AbstractStereotypedElementUMLSynchronizedOnFeatureAxisMana
* The list of resources listened.
*/
protected Collection<Resource> listenedResources;
+
+ /**
+ * The adapter used to listen changes on stereotypes application
+ */
+ private Adapter stereotypeApplicationListener = new AdapterImpl() {
+
+ @Override
+ public void notifyChanged(Notification notification) {
+ stereotypeApplicationHasChanged(notification);
+ }
+ };
/**
@@ -222,16 +233,16 @@ public abstract class AbstractStereotypedElementUMLSynchronizedOnFeatureAxisMana
// Bug 439501: The feature values must be the initial values order
// we filter them now
- for(final Object featureValue : featuresValue){
- for (final EObject current : getTableContext().eResource().getContents()) {
- if (!(current instanceof Element) && isInstanceOfRequiredStereotypeApplication(current)) {
- final Element baseElement = UMLUtil.getBaseElement(current);
- if (baseElement != null) {
- if (featureValue.equals(baseElement) && isAllowedContents(baseElement)) {
- this.managedObject.add(baseElement);
- this.stereotypedElementsMap.put(current, (baseElement));
- addStereotypeApplicationListener(current);
- }
+ for (final Object featureValue : featuresValue) {
+ //here we do the same thing than in the method isAllowedContent, code has been changed to improve performance (bug 505947)
+ if(featureValue instanceof Element){
+ final Element el = (Element) featureValue;
+ if(isAllowedAsBaseElement(el)){
+ final EObject requiredStereotypeApplication = getStereotypeApplication(el);
+ if(null!=requiredStereotypeApplication){
+ this.managedObject.add(el);
+ this.stereotypedElementsMap.put(requiredStereotypeApplication, (el));
+ addStereotypeApplicationListener(requiredStereotypeApplication);
}
}
}
@@ -347,13 +358,6 @@ public abstract class AbstractStereotypedElementUMLSynchronizedOnFeatureAxisMana
if (this.listenerMap.containsKey(stereotypeApplication)) {
return;
}
- final Adapter stereotypeApplicationListener = new AdapterImpl() {
-
- @Override
- public void notifyChanged(Notification notification) {
- stereotypeApplicationHasChanged(notification);
- }
- };
stereotypeApplication.eAdapters().add(stereotypeApplicationListener);
this.listenerMap.put(stereotypeApplication, stereotypeApplicationListener);
}
@@ -488,15 +492,9 @@ public abstract class AbstractStereotypedElementUMLSynchronizedOnFeatureAxisMana
* <code>true</code> if the elements has all required stererotypes applied on it
*/
protected final boolean hasRequiredStereotypes(final Element element) {
- for (final EObject current : element.getStereotypeApplications()) {
- if (isInstanceOfRequiredStereotypeApplication(current)) {
- return true;
- }
- }
- return false;
+ return null != getStereotypeApplication(element);
}
-
/**
*
* @param element

Back to the top