diff options
author | Vincent Lorenzo | 2016-10-14 08:31:43 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-10-17 10:45:47 +0000 |
commit | 2bc8ef24c1789a6a410be8f2aee46d1a6b6d89f2 (patch) | |
tree | a6d4f6f43411509c685ce7b6856095364205157e /plugins/uml/nattable | |
parent | 79b3d4e0edd4f08942f62b4123ba70b51af4883f (diff) | |
download | org.eclipse.papyrus-2bc8ef24c1789a6a410be8f2aee46d1a6b6d89f2.tar.gz org.eclipse.papyrus-2bc8ef24c1789a6a410be8f2aee46d1a6b6d89f2.tar.xz org.eclipse.papyrus-2bc8ef24c1789a6a410be8f2aee46d1a6b6d89f2.zip |
bug 505947: [Table] Improve the method AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager.initializeManagedObjectList()
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/uml/nattable')
-rw-r--r-- | plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/src/org/eclipse/papyrus/uml/nattable/manager/axis/AbstractStereotypedElementUMLSynchronizedOnFeatureAxisManager.java | 46 |
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 |