Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-09-08 13:42:18 +0000
committerGerrit Code Review @ Eclipse.org2014-09-08 13:42:18 +0000
commitd5006e16930097e40473bcf079644394767b1d59 (patch)
tree846675ee7f87f2ea91c67bf44a04f28d5629af51
parent826fe6e5382002fbfee854b4d015012090d4e97b (diff)
parent8f326427a8dca490bebf6ff96010ff36fe9ed1b8 (diff)
downloadorg.eclipse.papyrus-d5006e16930097e40473bcf079644394767b1d59.tar.gz
org.eclipse.papyrus-d5006e16930097e40473bcf079644394767b1d59.tar.xz
org.eclipse.papyrus-d5006e16930097e40473bcf079644394767b1d59.zip
Merge "441227: [Properties view] Create New Property view tabs not working https://bugs.eclipse.org/bugs/show_bug.cgi?id=441227"
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi32
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AttachedToResourceConstraint.java56
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx7
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeApplication.java16
4 files changed, 99 insertions, 12 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi b/plugins/infra/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi
index ad420a9045d..652e46f32b6 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi
+++ b/plugins/infra/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi
@@ -1,9 +1,27 @@
<?xml version="1.0" encoding="ASCII"?>
-<environment:ConstraintEnvironment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:environment="http://www.eclipse.org/papyrus/constraints/environment/0.9">
- <constraintTypes label="EMF Instance Of" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint"/>
- <constraintTypes label="True constraint" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.TrueConstraint"/>
- <constraintTypes label="EMF Query" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFQueryConstraint"/>
- <constraintTypes label="Java Instance Of" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaInstanceOf"/>
- <constraintTypes label="Java Query" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaQueryConstraint"/>
- <constraintTypes label="Has EAnnotation" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.HasEAnnotationConstraint"/>
+<environment:ConstraintEnvironment
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:environment="http://www.eclipse.org/papyrus/constraints/environment/0.9">
+ <constraintTypes
+ label="EMF Instance Of"
+ constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint"/>
+ <constraintTypes
+ label="True constraint"
+ constraintClass="org.eclipse.papyrus.infra.constraints.constraints.TrueConstraint"/>
+ <constraintTypes
+ label="EMF Query"
+ constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFQueryConstraint"/>
+ <constraintTypes
+ label="Java Instance Of"
+ constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaInstanceOf"/>
+ <constraintTypes
+ label="Java Query"
+ constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaQueryConstraint"/>
+ <constraintTypes
+ label="Has EAnnotation"
+ constraintClass="org.eclipse.papyrus.infra.constraints.constraints.HasEAnnotationConstraint"/>
+ <constraintTypes
+ label="Attached to Resource"
+ constraintClass="org.eclipse.papyrus.infra.constraints.constraints.AttachedToResourceConstraint"/>
</environment:ConstraintEnvironment>
diff --git a/plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AttachedToResourceConstraint.java b/plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AttachedToResourceConstraint.java
new file mode 100644
index 00000000000..5859aac77fd
--- /dev/null
+++ b/plugins/infra/org.eclipse.papyrus.infra.constraints/src/org/eclipse/papyrus/infra/constraints/constraints/AttachedToResourceConstraint.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.constraints.constraints;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+
+/**
+ * A properties view constraint that matches objects that are attached to some resource.
+ */
+public class AttachedToResourceConstraint extends AbstractConstraint {
+
+ /**
+ * Initializes me.
+ */
+ public AttachedToResourceConstraint() {
+ super();
+ }
+
+ @Override
+ protected boolean match(Object selection) {
+ boolean result = false;
+
+ EObject object = EMFHelper.getEObject(selection);
+
+ if (object != null) {
+ result = object.eResource() != null;
+ }
+
+ return result;
+ }
+
+ @Override
+ protected boolean equivalent(Constraint constraint) {
+ if (this == constraint) {
+ return true;
+ }
+ return constraint instanceof AttachedToResourceConstraint;
+ }
+
+ @Override
+ public String toString() {
+ return "AttachedToResourceConstraint"; //$NON-NLS-1$
+ }
+}
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx
index b77682da2c6..242804a867f 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/Model/UML/UML.ctx
@@ -1418,7 +1418,7 @@
<properties xsi:type="constraints:ValueProperty" name="umlClassName" value="Package"/>
</constraints>
</views>
- <views name="SingleElement" sections="//@tabs.2/@sections.1 //@tabs.1/@sections.0 //@tabs.1/@sections.1">
+ <views name="SingleElement" sections="//@tabs.1/@sections.0 //@tabs.1/@sections.1">
<constraints xsi:type="constraints:SimpleConstraint" name="isSingleElement" overrideable="false">
<constraintType href="ppe:/environment/org.eclipse.papyrus.uml.properties/Model/Environment.xmi#//@constraintTypes.0"/>
<properties xsi:type="constraints:ValueProperty" name="umlClassName" value="Element"/>
@@ -4223,6 +4223,11 @@
<properties xsi:type="constraints:ValueProperty" name="umlClassName" value="SignalEvent"/>
</constraints>
</views>
+ <views name="SingleProfiledElement" sections="//@tabs.2/@sections.1">
+ <constraints xsi:type="constraints:SimpleConstraint" name="isAttached">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi#//@constraintTypes.6"/>
+ </constraints>
+ </views>
<dataContexts name="UML" label="UML">
<elements name="Comment" supertypes="//@dataContexts.0/@elements.1">
<properties name="body" description="Specifies a string that is the comment."/>
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeApplication.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeApplication.java
index e9a6e3d811a..846a80965ee 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeApplication.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/StereotypeApplication.java
@@ -9,12 +9,14 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 417409
+ * Christian W. Damus (CEA) - bug 441227
*
*****************************************************************************/
package org.eclipse.papyrus.uml.properties.widgets;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.uml.profile.tree.objects.StereotypedElementTreeObject;
@@ -63,11 +65,17 @@ public class StereotypeApplication extends AbstractPropertyEditor {
if (element instanceof StereotypeApplicationModelElement) {
internalDoBinding();
- input.getObservable(propertyPath).addChangeListener(new IChangeListener() {
+ final IObservable property = input.getObservable(propertyPath);
+ property.addChangeListener(new IChangeListener() {
public void handleChange(ChangeEvent event) {
- // re-do the injection into the stereotype composite because the
- // underlying model element selection may have been changed
- internalDoBinding();
+ if ((self == null) || self.isDisposed()) {
+ // Desist
+ property.removeChangeListener(this);
+ } else {
+ // re-do the injection into the stereotype composite because the
+ // underlying model element selection may have been changed
+ internalDoBinding();
+ }
}
});
}

Back to the top