Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-02-23 07:25:39 -0500
committercletavernie2012-02-23 07:25:39 -0500
commit36a05b721aa31c92b6cf77bf668a954e939ae521 (patch)
tree8e6c1d22dd8ee5e618cfd251acdfa5b3b368cb50 /plugins
parent9c1e0cbf09d24c7e3a0076972b3c73ed87df5c50 (diff)
downloadorg.eclipse.papyrus-36a05b721aa31c92b6cf77bf668a954e939ae521.tar.gz
org.eclipse.papyrus-36a05b721aa31c92b6cf77bf668a954e939ae521.tar.xz
org.eclipse.papyrus-36a05b721aa31c92b6cf77bf668a954e939ae521.zip
351802: [Constraints] The Property View constraints model should be more generic
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351802
Diffstat (limited to 'plugins')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/Model/custom.querySet4
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java13
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java4
3 files changed, 16 insertions, 5 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/Model/custom.querySet b/plugins/customization/org.eclipse.papyrus.customization.properties/Model/custom.querySet
index 910d951ec36..75254880e42 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/Model/custom.querySet
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/Model/custom.querySet
@@ -11,11 +11,11 @@
<returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<scope href="http://www.eclipse.org/papyrus/constraints/0.9#//ConstraintDescriptor"/>
</queries>
- <queries xsi:type="query:OCLModelQuery" name="isEcoreInstanceOf" lowerBound="1" query="self.constraintType.constraintClass = 'org.eclipse.papyrus.views.properties.constraints.EMFInstanceOfConstraint'">
+ <queries xsi:type="query:OCLModelQuery" name="isEcoreInstanceOf" lowerBound="1" query="self.constraintType.constraintClass = 'org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint'">
<returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<scope href="http://www.eclipse.org/papyrus/constraints/0.9#//ConstraintDescriptor"/>
</queries>
- <queries xsi:type="query:OCLModelQuery" name="isOclQuery" lowerBound="1" query="self.constraintType.constraintClass = 'org.eclipse.papyrus.views.properties.constraints.EMFQueryConstraint'">
+ <queries xsi:type="query:OCLModelQuery" name="isOclQuery" lowerBound="1" query="self.constraintType.constraintClass = 'org.eclipse.papyrus.infra.constraints.constraints.EMFQueryConstraint'">
<returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<scope href="http://www.eclipse.org/papyrus/constraints/0.9#//ConstraintDescriptor"/>
</queries>
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java
index 787ca059c2c..7c7a084f2de 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java
@@ -123,7 +123,18 @@ public class GenericAttributeObservable extends AbstractObservableValue {
EObject attribute = findAttribute();
EList<? extends EObject> collection = (EList<? extends EObject>)source.eGet(createIn);
- CompoundCommand command = new CompoundCommand(String.format("Set %s value", propertyPath)); //$NON-NLS-1$
+ CompoundCommand command = new CompoundCommand(String.format("Set %s value", propertyPath)) {
+
+ @Override
+ public boolean prepare() {
+ //Only test the first command's canExecute(), as the following ones depend on the execution of the first one
+ //Can we use a StrictCompoundCommand here ?
+ if(commandList.isEmpty()) {
+ return true;
+ }
+ return commandList.get(0).canExecute();
+ }
+ };
if(value == null || value.equals("")) { //$NON-NLS-1$
if(attribute != null) {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
index 3d0167e7291..e206b8874d8 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
@@ -17,10 +17,10 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.papyrus.infra.constraints.ConfigProperty;
+import org.eclipse.papyrus.infra.constraints.ConstraintsFactory;
import org.eclipse.papyrus.infra.constraints.ConstraintsPackage;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.properties.Activator;
-import org.eclipse.papyrus.views.properties.contexts.ContextsFactory;
import org.eclipse.papyrus.views.properties.contexts.DataContextElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElement;
import org.eclipse.papyrus.views.properties.modelelement.ModelElementFactory;
@@ -48,7 +48,7 @@ public class GenericPropertyModelElementFactory implements ModelElementFactory {
EClass referenceProperty = ConstraintsPackage.eINSTANCE.getReferenceProperty();
EStructuralFeature attributes = ConstraintsPackage.eINSTANCE.getSimpleConstraint_Properties();
- return new GenericAttributeModelElement(source, domain, attributes, ContextsFactory.eINSTANCE, valueProperty, referenceProperty);
+ return new GenericAttributeModelElement(source, domain, attributes, ConstraintsFactory.eINSTANCE, valueProperty, referenceProperty);
}
// public List<ModelElement> createFromDataSource(ModelElement currentElement, DataSource source, String propertyPath, DataContextElement context) {

Back to the top