Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/.settings/.api_filters11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java25
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/.settings/.api_filters11
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java35
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java6
5 files changed, 59 insertions, 29 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/.settings/.api_filters b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/.settings/.api_filters
new file mode 100644
index 00000000000..c5b036f681a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/.settings/.api_filters
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.papyrus.uml.diagram.menu" version="2">
+ <resource path="src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java" type="org.eclipse.papyrus.uml.diagram.menu.actions.handlers.AlignementHandler">
+ <filter comment="Removed invalid (and unused) field that causes memory leaks" id="338755678">
+ <message_arguments>
+ <message_argument value="org.eclipse.papyrus.uml.diagram.menu.actions.handlers.AlignementHandler"/>
+ <message_argument value="action"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
index 372f6ec2494..cba60603b2f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
@@ -30,9 +30,6 @@ import org.eclipse.papyrus.uml.diagram.menu.actions.CustomAlignAction;
*/
public class AlignementHandler extends ParametricAndListeningHandler {
- /** the action executed by this handler */
- protected CustomAlignAction action = null;
-
/**
*
* Constructor.
@@ -52,10 +49,10 @@ public class AlignementHandler extends ParametricAndListeningHandler {
@Override
protected Command getCommand() {
super.getCommand();
- this.action = new CustomAlignAction(getAlignment(this.parameter), this.getSelectedElements());
+ CustomAlignAction action = new CustomAlignAction(getAlignment(this.parameter), this.getSelectedElements());
Command cmd = action.getCommand();
return (cmd == null) ? UnexecutableCommand.INSTANCE : cmd;
-
+
}
/**
@@ -63,15 +60,15 @@ public class AlignementHandler extends ParametricAndListeningHandler {
* @param param
* the parameter for the alignment action
* @return
- * the value represented by this parameter, this valu can be :
+ * the value represented by this parameter, this valu can be :
* <ul>
- * <li> {@link PositionConstants#NONE}</li>
- * <li> {@link PositionConstants#TOP}</li>
- * <li> {@link PositionConstants#BOTTOM}</li>
- * <li> {@link PositionConstants#MIDDLE}</li>
- * <li> {@link PositionConstants#LEFT}</li>
- * <li> {@link PositionConstants#RIGHT}</li>
- * <li> {@link PositionConstants#CENTER}</li>
+ * <li>{@link PositionConstants#NONE}</li>
+ * <li>{@link PositionConstants#TOP}</li>
+ * <li>{@link PositionConstants#BOTTOM}</li>
+ * <li>{@link PositionConstants#MIDDLE}</li>
+ * <li>{@link PositionConstants#LEFT}</li>
+ * <li>{@link PositionConstants#RIGHT}</li>
+ * <li>{@link PositionConstants#CENTER}</li>
* </ul>
*/
public int getAlignment(String param) {
@@ -90,5 +87,5 @@ public class AlignementHandler extends ParametricAndListeningHandler {
}
return PositionConstants.NONE;
}
-
+
}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/.settings/.api_filters b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/.settings/.api_filters
new file mode 100644
index 00000000000..5c64599690b
--- /dev/null
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/.settings/.api_filters
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.papyrus.uml.properties" version="2">
+ <resource path="src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java" type="org.eclipse.papyrus.uml.properties.constraints.HasStereotypeConstraint">
+ <filter comment="Change type (&amp; visibility) of a memory-leak field that should no longer be used" id="388018290">
+ <message_arguments>
+ <message_argument value="org.eclipse.papyrus.uml.properties.constraints.HasStereotypeConstraint"/>
+ <message_argument value="umlElement"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java
index b1398d0fad7..a30330dedab 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/constraints/HasStereotypeConstraint.java
@@ -11,6 +11,8 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.constraints;
+import java.lang.ref.WeakReference;
+
import org.eclipse.papyrus.infra.constraints.SimpleConstraint;
import org.eclipse.papyrus.infra.constraints.constraints.AbstractConstraint;
import org.eclipse.papyrus.infra.constraints.constraints.Constraint;
@@ -34,16 +36,24 @@ public class HasStereotypeConstraint extends AbstractConstraint {
/**
* The UML element on which the stereotype may be applied
*/
- protected Element umlElement;
+ // FIXME: Constraints shouldn't retain any element from the model, as they are registered in a global scope that is never disposed
+ // Unfortunately, the #overrides method has no contextual information and can't properly check stereotype inheritance tree
+ // Using a resource set local to this constraint would either leak profiles, or require multiple loading/unloading iterations
+ // Moreover, this constraint only relies on a Stereotype Name, without a Profile URI, so it wouldn't be able to find
+ // the correct profile without a context element.
+ // For now, the WeakReference is an acceptable compromise.
+ private WeakReference<Element> umlElement;
@Override
public boolean match(Object selection) {
- umlElement = UMLUtil.resolveUMLElement(selection);
- if (umlElement == null) {
+ Element element = UMLUtil.resolveUMLElement(selection);
+ if (element == null) {
return false;
}
- Stereotype stereotype = UMLUtil.getAppliedStereotype(umlElement, stereotypeName, false);
+ umlElement = new WeakReference<Element>(element);
+
+ Stereotype stereotype = UMLUtil.getAppliedStereotype(element, stereotypeName, false);
return stereotype != null;
}
@@ -59,14 +69,17 @@ public class HasStereotypeConstraint extends AbstractConstraint {
if (constraint instanceof HasStereotypeConstraint) {
HasStereotypeConstraint stereotypeConstraint = (HasStereotypeConstraint) constraint;
if (!stereotypeName.equals(stereotypeConstraint.stereotypeName)) {
- Stereotype thisStereotype = umlElement.getApplicableStereotype(stereotypeName);
+ Element element = umlElement.get();
+ if (element != null) {
+ Stereotype thisStereotype = element.getApplicableStereotype(stereotypeName);
- // The otherStereotype can match the constraint without being applicable (e.g. abstract stereotype...)
- // We can't rely on "getApplicableStereotype"
- Stereotype otherStereotype = UMLUtil.findStereotype(umlElement, stereotypeConstraint.stereotypeName);
- // Stereotype otherStereotype = umlElement.getApplicableStereotype(stereotypeConstraint.stereotypeName);
- if (UMLUtil.getAllSuperStereotypes(thisStereotype).contains(otherStereotype)) {
- overrides = true;
+ // The otherStereotype can match the constraint without being applicable (e.g. abstract stereotype...)
+ // We can't rely on "getApplicableStereotype"
+ Stereotype otherStereotype = UMLUtil.findStereotype(element, stereotypeConstraint.stereotypeName);
+ // Stereotype otherStereotype = umlElement.getApplicableStereotype(stereotypeConstraint.stereotypeName);
+ if (UMLUtil.getAllSuperStereotypes(thisStereotype).contains(otherStereotype)) {
+ overrides = true;
+ }
}
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
index 42cf0482620..e2e9f837787 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java
@@ -185,9 +185,6 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
/** Flag to avoid reentrant call to refresh. */
private AtomicBoolean isRefreshing = new AtomicBoolean(false);
- /** Currently selected tree item */
- private TreeItem currentItem;
-
/** Navigation menu for selected tree item */
private NavigationMenu navigationMenu;
@@ -1011,8 +1008,9 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti
saveAndDirtyService = null;
undoContext = null;
editingDomain = null;
- editingDomain = null;
lastTrans = null;
+ viewerFilter.clearCache();
+ viewerFilter = null;
}
/**

Back to the top