Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Bégaudeau2016-10-19 07:43:55 +0000
committerPierre-Charles David2016-10-19 13:56:49 +0000
commit90732f31868b75bc717a3e7cd408d75369cd2d33 (patch)
tree64909faa6d2fcf25044b44c2287870f98cc5b599
parentd7b5834511b4ba3ce259f47daf0bcf2e0a1e304b (diff)
downloadorg.eclipse.sirius-90732f31868b75bc717a3e7cd408d75369cd2d33.tar.gz
org.eclipse.sirius-90732f31868b75bc717a3e7cd408d75369cd2d33.tar.xz
org.eclipse.sirius-90732f31868b75bc717a3e7cd408d75369cd2d33.zip
[496058] Improve the default rules
1) Fix an issue with duplicate widgets for references (list and reference) caused by a fix for a bug regarding the dynamic mappings. 2) Remove support for categories in the default rules Bug: 496058 Change-Id: I5a3f89fca20998785349217ab025e5cc9546e1a7 Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ViewExtensionDescriptionItemProvider.java7
-rw-r--r--plugins/org.eclipse.sirius.properties/model/properties.ecore8
-rw-r--r--plugins/org.eclipse.sirius.properties/model/properties.genmodel8
-rw-r--r--plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/EditSupport.java16
-rw-r--r--plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/EditSupportImpl.java9
-rw-r--r--plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java10
-rw-r--r--plugins/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.sirius.ui.properties/model/properties.odesign19
-rw-r--r--plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EEFViewCategory.java305
-rw-r--r--plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EditSupportSpec.java154
10 files changed, 107 insertions, 432 deletions
diff --git a/plugins/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ViewExtensionDescriptionItemProvider.java b/plugins/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ViewExtensionDescriptionItemProvider.java
index ffd31359cd..25dd57a212 100644
--- a/plugins/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ViewExtensionDescriptionItemProvider.java
+++ b/plugins/org.eclipse.sirius.properties.edit/src-gen/org/eclipse/sirius/properties/provider/ViewExtensionDescriptionItemProvider.java
@@ -45,7 +45,8 @@ import org.eclipse.sirius.properties.ViewExtensionDescription;
public class ViewExtensionDescriptionItemProvider extends ItemProviderAdapter
implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
/**
- * The default expression to use as semanticCandidatesExpression for newly created elements.
+ * The default expression to use as semanticCandidatesExpression for newly
+ * created elements.
*/
public static final String DEFAULT_SEMANTIC_CANDIDATES_EXPRESSION = "var:self"; //$NON-NLS-1$
@@ -197,12 +198,12 @@ public class ViewExtensionDescriptionItemProvider extends ItemProviderAdapter
PageDescription page = PropertiesFactory.eINSTANCE.createPageDescription();
page.setLabelExpression("Page"); //$NON-NLS-1$
- page.setSemanticCandidateExpression(DEFAULT_SEMANTIC_CANDIDATES_EXPRESSION);
+ page.setSemanticCandidateExpression(ViewExtensionDescriptionItemProvider.DEFAULT_SEMANTIC_CANDIDATES_EXPRESSION);
newChildDescriptors.add(createChildParameter(PropertiesPackage.Literals.VIEW_EXTENSION_DESCRIPTION__PAGES, page));
GroupDescription group = PropertiesFactory.eINSTANCE.createGroupDescription();
group.setLabelExpression("Group"); //$NON-NLS-1$
- group.setSemanticCandidateExpression(DEFAULT_SEMANTIC_CANDIDATES_EXPRESSION);
+ group.setSemanticCandidateExpression(ViewExtensionDescriptionItemProvider.DEFAULT_SEMANTIC_CANDIDATES_EXPRESSION);
newChildDescriptors.add(createChildParameter(PropertiesPackage.Literals.VIEW_EXTENSION_DESCRIPTION__GROUPS, group));
}
diff --git a/plugins/org.eclipse.sirius.properties/model/properties.ecore b/plugins/org.eclipse.sirius.properties/model/properties.ecore
index 439c9c52bf..f2f7f69b3a 100644
--- a/plugins/org.eclipse.sirius.properties/model/properties.ecore
+++ b/plugins/org.eclipse.sirius.properties/model/properties.ecore
@@ -412,12 +412,16 @@
<eOperations name="getDescription" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eParameters name="eStructuralFeature" lowerBound="1" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStructuralFeature"/>
</eOperations>
- <eOperations name="getCategory" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eOperations name="getCategories" upperBound="-1" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
<eOperations name="getEStructuralFeatures" upperBound="-1" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EStructuralFeature"/>
<eOperations name="setValue" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject">
<eParameters name="feature" lowerBound="1" eType="ecore:EClass ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EStructuralFeature"/>
<eParameters name="newValue" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
</eOperations>
+ <eOperations name="needsTextWidget" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean">
+ <eParameters name="eStructuralFeature" lowerBound="1" eType="ecore:EClass ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EStructuralFeature"/>
+ </eOperations>
+ <eOperations name="needsCheckboxWidget" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean">
+ <eParameters name="eStructuralFeature" lowerBound="1" eType="ecore:EClass ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EStructuralFeature"/>
+ </eOperations>
</eClassifiers>
</ecore:EPackage>
diff --git a/plugins/org.eclipse.sirius.properties/model/properties.genmodel b/plugins/org.eclipse.sirius.properties/model/properties.genmodel
index 3fbafc758f..c516a8702f 100644
--- a/plugins/org.eclipse.sirius.properties/model/properties.genmodel
+++ b/plugins/org.eclipse.sirius.properties/model/properties.genmodel
@@ -265,13 +265,17 @@
<genOperations ecoreOperation="properties.ecore#//EditSupport/getDescription">
<genParameters ecoreParameter="properties.ecore#//EditSupport/getDescription/eStructuralFeature"/>
</genOperations>
- <genOperations ecoreOperation="properties.ecore#//EditSupport/getCategory"/>
- <genOperations ecoreOperation="properties.ecore#//EditSupport/getCategories"/>
<genOperations ecoreOperation="properties.ecore#//EditSupport/getEStructuralFeatures"/>
<genOperations ecoreOperation="properties.ecore#//EditSupport/setValue">
<genParameters ecoreParameter="properties.ecore#//EditSupport/setValue/feature"/>
<genParameters ecoreParameter="properties.ecore#//EditSupport/setValue/newValue"/>
</genOperations>
+ <genOperations ecoreOperation="properties.ecore#//EditSupport/needsTextWidget">
+ <genParameters ecoreParameter="properties.ecore#//EditSupport/needsTextWidget/eStructuralFeature"/>
+ </genOperations>
+ <genOperations ecoreOperation="properties.ecore#//EditSupport/needsCheckboxWidget">
+ <genParameters ecoreParameter="properties.ecore#//EditSupport/needsCheckboxWidget/eStructuralFeature"/>
+ </genOperations>
</genClasses>
</genPackages>
</genmodel:GenModel>
diff --git a/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/EditSupport.java b/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/EditSupport.java
index 259f0f6f0b..a85529584c 100644
--- a/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/EditSupport.java
+++ b/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/EditSupport.java
@@ -84,33 +84,33 @@ public interface EditSupport extends EObject {
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @model kind="operation" required="true"
+ * @model kind="operation"
* @generated
*/
- String getCategory();
+ EList<EStructuralFeature> getEStructuralFeatures();
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @model kind="operation"
+ * @model featureRequired="true" newValueRequired="true"
* @generated
*/
- EList<EObject> getCategories();
+ Object setValue(EStructuralFeature feature, Object newValue);
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @model kind="operation"
+ * @model eStructuralFeatureRequired="true"
* @generated
*/
- EList<EStructuralFeature> getEStructuralFeatures();
+ boolean needsTextWidget(EStructuralFeature eStructuralFeature);
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
- * @model featureRequired="true" newValueRequired="true"
+ * @model eStructuralFeatureRequired="true"
* @generated
*/
- Object setValue(EStructuralFeature feature, Object newValue);
+ boolean needsCheckboxWidget(EStructuralFeature eStructuralFeature);
} // EditSupport
diff --git a/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/EditSupportImpl.java b/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/EditSupportImpl.java
index 8dc430908e..ad472ed137 100644
--- a/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/EditSupportImpl.java
+++ b/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/EditSupportImpl.java
@@ -13,7 +13,6 @@ package org.eclipse.sirius.properties.impl;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.sirius.properties.EditSupport;
@@ -136,7 +135,7 @@ public class EditSupportImpl extends MinimalEObjectImpl.Container implements Edi
* @generated
*/
@Override
- public String getCategory() {
+ public EList<EStructuralFeature> getEStructuralFeatures() {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
@@ -148,7 +147,7 @@ public class EditSupportImpl extends MinimalEObjectImpl.Container implements Edi
* @generated
*/
@Override
- public EList<EObject> getCategories() {
+ public Object setValue(EStructuralFeature feature, Object newValue) {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
@@ -160,7 +159,7 @@ public class EditSupportImpl extends MinimalEObjectImpl.Container implements Edi
* @generated
*/
@Override
- public EList<EStructuralFeature> getEStructuralFeatures() {
+ public boolean needsTextWidget(EStructuralFeature eStructuralFeature) {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
@@ -172,7 +171,7 @@ public class EditSupportImpl extends MinimalEObjectImpl.Container implements Edi
* @generated
*/
@Override
- public Object setValue(EStructuralFeature feature, Object newValue) {
+ public boolean needsCheckboxWidget(EStructuralFeature eStructuralFeature) {
// TODO: implement this method
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
diff --git a/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java b/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java
index aa90353ddf..0b5a731920 100644
--- a/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java
+++ b/plugins/org.eclipse.sirius.properties/src-gen/org/eclipse/sirius/properties/impl/PropertiesPackageImpl.java
@@ -3185,16 +3185,18 @@ public class PropertiesPackageImpl extends EPackageImpl implements PropertiesPac
op = addEOperation(editSupportEClass, ecorePackage.getEString(), "getDescription", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
addEParameter(op, ecorePackage.getEStructuralFeature(), "eStructuralFeature", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
- addEOperation(editSupportEClass, ecorePackage.getEString(), "getCategory", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
-
- addEOperation(editSupportEClass, ecorePackage.getEObject(), "getCategories", 0, -1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
-
addEOperation(editSupportEClass, ecorePackage.getEStructuralFeature(), "getEStructuralFeatures", 0, -1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
op = addEOperation(editSupportEClass, ecorePackage.getEJavaObject(), "setValue", 0, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
addEParameter(op, theEcorePackage.getEStructuralFeature(), "feature", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
addEParameter(op, ecorePackage.getEJavaObject(), "newValue", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
+ op = addEOperation(editSupportEClass, theEcorePackage.getEBoolean(), "needsTextWidget", 0, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
+ addEParameter(op, theEcorePackage.getEStructuralFeature(), "eStructuralFeature", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
+
+ op = addEOperation(editSupportEClass, theEcorePackage.getEBoolean(), "needsCheckboxWidget", 0, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
+ addEParameter(op, theEcorePackage.getEStructuralFeature(), "eStructuralFeature", 1, 1, EPackageImpl.IS_UNIQUE, EPackageImpl.IS_ORDERED); //$NON-NLS-1$
+
// Initialize enums and add enum literals
initEEnum(filL_LAYOUT_ORIENTATIONEEnum, org.eclipse.sirius.properties.FILL_LAYOUT_ORIENTATION.class, "FILL_LAYOUT_ORIENTATION"); //$NON-NLS-1$
addEEnumLiteral(filL_LAYOUT_ORIENTATIONEEnum, org.eclipse.sirius.properties.FILL_LAYOUT_ORIENTATION.VERTICAL);
diff --git a/plugins/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF
index d1c788ad9a..3c99a6988b 100644
--- a/plugins/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.sirius.ui.properties/META-INF/MANIFEST.MF
@@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.eef;bundle-version="1.6.0",
org.eclipse.ui.forms;bundle-version="[3.0.0,4.0.0)",
org.eclipse.emf.edit.ui;bundle-version="[2.8.0,3.0.0)",
org.eclipse.sirius.common.acceleo.aql;bundle-version="4.1.0",
- org.eclipse.acceleo.query;bundle-version="5.0.2"
+ org.eclipse.acceleo.query;bundle-version="5.0.2",
+ org.eclipse.sirius.properties.ext.widgets.reference;bundle-version="[4.1.1,5.0.0)"
Import-Package: com.ibm.icu.util;version="54.1.0",
org.eclipse.sirius.ui.business.api.dialect;version="3.1.0",
org.eclipse.sirius.ui.tools.api.properties;version="2.1.0"
diff --git a/plugins/org.eclipse.sirius.ui.properties/model/properties.odesign b/plugins/org.eclipse.sirius.ui.properties/model/properties.odesign
index 72a1af4a9d..0950935f4b 100644
--- a/plugins/org.eclipse.sirius.ui.properties/model/properties.odesign
+++ b/plugins/org.eclipse.sirius.ui.properties/model/properties.odesign
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="ASCII"?>
<properties:ViewExtensionDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:properties="http://www.eclipse.org/sirius/properties/1.0.0" xmlns:properties-ext-widgets-reference="http://www.eclipse.org/sirius/properties/1.0.0/ext/widgets/reference" xmlns:tool="http://www.eclipse.org/sirius/description/tool/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/tool/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description/tool" identifier="org.eclipse.sirius.ui.properties">
<pages identifier="org.eclipse.sirius.ui.properties.defaultpage" labelExpression="aql:input.emfEditServices(self).getTabName()" semanticCandidateExpression="aql:input.getAllSemanticElements()" groups="//@groups.0"/>
- <groups identifier="org.eclipse.sirius.ui.properties.defaultgroup" labelExpression="aql:input.emfEditServices(self).getCategory()" semanticCandidateExpression="aql:input.emfEditServices(self).getCategories()" preconditionExpression="">
+ <groups identifier="org.eclipse.sirius.ui.properties.defaultgroup" labelExpression="Properties" semanticCandidateExpression="var:self" preconditionExpression="">
<controls xsi:type="properties:DynamicMappingFor" iterator="eStructuralFeature" iterableExpression="aql:input.emfEditServices(self).getEStructuralFeatures()">
- <ifs predicateExpression="aql:(eStructuralFeature.eType.instanceTypeName = 'java.lang.String' or eStructuralFeature.eType.instanceTypeName = 'int' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Integer' or eStructuralFeature.eType.instanceTypeName = 'double' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Double' or eStructuralFeature.eType.instanceTypeName = 'char' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Character' or eStructuralFeature.eType.instanceTypeName = 'short' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Short' or eStructuralFeature.eType.instanceTypeName = 'long' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Long' or eStructuralFeature.eType.instanceTypeName = 'float' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Float' or eStructuralFeature.eType.instanceTypeName = 'java.util.Date') and not(eStructuralFeature.many) and not input.emfEditServices(self).isMultiline(eStructuralFeature)">
+ <ifs predicateExpression="aql:input.emfEditServices(self).needsTextWidget(eStructuralFeature) and not input.emfEditServices(self).isMultiline(eStructuralFeature)">
<widget xsi:type="properties:TextDescription" identifier="sirius_default_rules_mono_string" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)+':'" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature.name)">
<initialOperation>
<firstModelOperations xsi:type="tool:ChangeContext" browseExpression="aql:input.emfEditServices(self).setValue(eStructuralFeature, newValue)"/>
@@ -15,7 +15,7 @@
</conditionalStyles>
</widget>
</ifs>
- <ifs predicateExpression="aql:(eStructuralFeature.eType.instanceTypeName = 'java.lang.String' or eStructuralFeature.eType.instanceTypeName = 'int' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Integer' or eStructuralFeature.eType.instanceTypeName = 'double' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Double' or eStructuralFeature.eType.instanceTypeName = 'char' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Character' or eStructuralFeature.eType.instanceTypeName = 'short' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Short' or eStructuralFeature.eType.instanceTypeName = 'long' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Long' or eStructuralFeature.eType.instanceTypeName = 'float' or eStructuralFeature.eType.instanceTypeName = 'java.lang.Float' or eStructuralFeature.eType.instanceTypeName = 'java.util.Date') and not(eStructuralFeature.many) and input.emfEditServices(self).isMultiline(eStructuralFeature)">
+ <ifs predicateExpression="aql:input.emfEditServices(self).needsTextWidget(eStructuralFeature) and input.emfEditServices(self).isMultiline(eStructuralFeature)">
<widget xsi:type="properties:TextAreaDescription" identifier="sirius_default_rules_multi_string" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)+':'" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature.name)">
<initialOperation>
<firstModelOperations xsi:type="tool:ChangeContext" browseExpression="aql:input.emfEditServices(self).setValue(eStructuralFeature, newValue)"/>
@@ -27,7 +27,7 @@
</conditionalStyles>
</widget>
</ifs>
- <ifs predicateExpression="aql:(eStructuralFeature.eType.instanceTypeName = 'java.lang.Boolean' or eStructuralFeature.eType.instanceTypeName = 'boolean') and not(eStructuralFeature.many)">
+ <ifs predicateExpression="aql:input.emfEditServices(self).needsCheckboxWidget(eStructuralFeature)">
<widget xsi:type="properties:CheckboxDescription" identifier="sirius_default_rules_mono_boolean" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature.name)">
<initialOperation>
<firstModelOperations xsi:type="tool:ChangeContext" browseExpression="aql:input.emfEditServices(self).setValue(eStructuralFeature, newValue)"/>
@@ -51,14 +51,11 @@
</conditionalStyles>
</widget>
</ifs>
- <ifs predicateExpression="aql:eStructuralFeature.oclIsKindOf(ecore::EReference) and not(eStructuralFeature.containment) and not(eStructuralFeature.many)">
- <widget xsi:type="properties-ext-widgets-reference:ExtReferenceDescription" identifier="sirius_default_rules_mono_noncontainment_reference" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)+':'" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" referenceNameExpression="aql:eStructuralFeature.name"/>
+ <ifs predicateExpression="aql:eStructuralFeature.oclIsKindOf(ecore::EAttribute) and eStructuralFeature.many">
+ <widget xsi:type="properties:ListDescription" identifier="sirius_default_rules_eattribute_many" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)+':'" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature.name)" displayExpression="aql:input.emfEditServices(value).getText()"/>
</ifs>
- <ifs predicateExpression="aql:eStructuralFeature.oclIsKindOf(ecore::EReference) and not(eStructuralFeature.containment) and eStructuralFeature.many">
- <widget xsi:type="properties-ext-widgets-reference:ExtReferenceDescription" identifier="sirius_default_rules_multi_noncontainment_reference" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)+':'" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" referenceNameExpression="aql:eStructuralFeature.name"/>
- </ifs>
- <ifs predicateExpression="aql:eStructuralFeature.many">
- <widget xsi:type="properties:ListDescription" identifier="sirius_default_rules_many" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)+':'" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature.name)" displayExpression="aql:input.emfEditServices(value).getText()"/>
+ <ifs predicateExpression="aql:eStructuralFeature.oclIsKindOf(ecore::EReference)">
+ <widget xsi:type="properties-ext-widgets-reference:ExtReferenceDescription" identifier="sirius_default_rules_ereference" labelExpression="aql:input.emfEditServices(self).getText(eStructuralFeature)+':'" helpExpression="aql:input.emfEditServices(self).getDescription(eStructuralFeature)" referenceNameExpression="aql:eStructuralFeature.name"/>
</ifs>
</controls>
</groups>
diff --git a/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EEFViewCategory.java b/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EEFViewCategory.java
deleted file mode 100644
index 3f63408827..0000000000
--- a/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EEFViewCategory.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2016 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.sirius.ui.properties.internal;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EOperation;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.Resource.Internal;
-
-/**
- * Provides an EObject which represent the categories defined for the structural
- * features of an eObject.
- *
- * @see SiriusToolServices#eefViewCategories(EObject)
- * @see SiriusToolServices#eefViewEStructuralFeatures(EObject)
- *
- * @author mbats
- */
-public class EEFViewCategory implements InternalEObject {
- private InternalEObject eObject;
-
- private String category;
-
- /**
- * Default constructor.
- *
- * @param eObject
- * The EObject
- * @param category
- * The category
- */
- public EEFViewCategory(InternalEObject eObject, String category) {
- this.eObject = eObject;
- this.category = category;
- }
-
- public EObject getWrappedEObject() {
- return eObject;
- }
-
- @Override
- public EList<Adapter> eAdapters() {
- return eObject.eAdapters();
- }
-
- @Override
- public boolean eDeliver() {
- return eObject.eDeliver();
- }
-
- @Override
- public void eSetDeliver(boolean deliver) {
- eObject.eSetDeliver(deliver);
- }
-
- @Override
- public void eNotify(Notification notification) {
- eObject.eNotify(notification);
- }
-
- @Override
- public EClass eClass() {
- return eObject.eClass();
- }
-
- @Override
- public Resource eResource() {
- return eObject.eResource();
- }
-
- @Override
- public EObject eContainer() {
- return eObject.eContainer();
- }
-
- @Override
- public EStructuralFeature eContainingFeature() {
- return eObject.eContainingFeature();
- }
-
- @Override
- public EReference eContainmentFeature() {
- return eObject.eContainmentFeature();
- }
-
- @Override
- public EList<EObject> eContents() {
- return eObject.eContents();
- }
-
- @Override
- public TreeIterator<EObject> eAllContents() {
- return eObject.eAllContents();
- }
-
- @Override
- public boolean eIsProxy() {
- return eObject.eIsProxy();
- }
-
- @Override
- public EList<EObject> eCrossReferences() {
- return eObject.eCrossReferences();
- }
-
- @Override
- public Object eGet(EStructuralFeature feature) {
- return eObject.eGet(feature);
- }
-
- @Override
- public Object eGet(EStructuralFeature feature, boolean resolve) {
- return eObject.eGet(feature, resolve);
- }
-
- @Override
- public void eSet(EStructuralFeature feature, Object newValue) {
- eObject.eSet(feature, newValue);
- }
-
- @Override
- public boolean eIsSet(EStructuralFeature feature) {
- return eObject.eIsSet(feature);
- }
-
- @Override
- public void eUnset(EStructuralFeature feature) {
- eObject.eUnset(feature);
- }
-
- @Override
- public Object eInvoke(EOperation operation, EList<?> arguments) throws InvocationTargetException {
- return eObject.eInvoke(operation, arguments);
- }
-
- public String getCategory() {
- return category;
- }
-
- @Override
- public boolean eNotificationRequired() {
- return eObject.eNotificationRequired();
- }
-
- @Override
- public String eURIFragmentSegment(EStructuralFeature eFeature, EObject object) {
- return eObject.eURIFragmentSegment(eFeature, object);
- }
-
- @Override
- public EObject eObjectForURIFragmentSegment(String uriFragmentSegment) {
- return eObject.eObjectForURIFragmentSegment(uriFragmentSegment);
- }
-
- @Override
- public void eSetClass(EClass eClass) {
- eObject.eSetClass(eClass);
- }
-
- @Override
- public Setting eSetting(EStructuralFeature feature) {
- return eObject.eSetting(feature);
- }
-
- @Override
- public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
- return eObject.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
- }
-
- @Override
- public int eContainerFeatureID() {
- return eObject.eContainerFeatureID();
- }
-
- @Override
- public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
- return eObject.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
- }
-
- @Override
- public int eDerivedOperationID(int baseOperationID, Class<?> baseClass) {
- return eObject.eDerivedOperationID(baseOperationID, baseClass);
- }
-
- @Override
- public NotificationChain eSetResource(Internal resource, NotificationChain notifications) {
- return eObject.eSetResource(resource, notifications);
- }
-
- @Override
- public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class<?> baseClass, NotificationChain notifications) {
- return eObject.eInverseAdd(otherEnd, featureID, baseClass, notifications);
- }
-
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class<?> baseClass, NotificationChain notifications) {
- return eObject.eInverseRemove(otherEnd, featureID, baseClass, notifications);
- }
-
- @Override
- public NotificationChain eBasicSetContainer(InternalEObject newContainer, int newContainerFeatureID, NotificationChain notifications) {
- return eObject.eBasicSetContainer(newContainer, newContainerFeatureID, notifications);
- }
-
- @Override
- public NotificationChain eBasicRemoveFromContainer(NotificationChain notifications) {
- return eObject.eBasicRemoveFromContainer(notifications);
- }
-
- @Override
- public URI eProxyURI() {
- return eObject.eProxyURI();
- }
-
- @Override
- public void eSetProxyURI(URI uri) {
- eObject.eSetProxyURI(uri);
- }
-
- @Override
- public EObject eResolveProxy(InternalEObject proxy) {
- return eObject.eResolveProxy(proxy);
- }
-
- @Override
- public InternalEObject eInternalContainer() {
- return eObject.eInternalContainer();
- }
-
- @Override
- public Internal eInternalResource() {
- return eObject.eInternalResource();
- }
-
- @Override
- public Internal eDirectResource() {
- return eObject.eDirectResource();
- }
-
- @Override
- public EStore eStore() {
- return eObject.eStore();
- }
-
- @Override
- public void eSetStore(EStore store) {
- eObject.eSetStore(store);
- }
-
- @Override
- public Object eGet(EStructuralFeature eFeature, boolean resolve, boolean coreType) {
- return eObject.eGet(eFeature, resolve, coreType);
- }
-
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- return eObject.eGet(featureID, resolve, coreType);
- }
-
- @Override
- public void eSet(int featureID, Object newValue) {
- eObject.eSet(featureID, newValue);
- }
-
- @Override
- public void eUnset(int featureID) {
- eObject.eUnset(featureID);
- }
-
- @Override
- public boolean eIsSet(int featureID) {
- return eObject.eIsSet(featureID);
- }
-
- @Override
- public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException {
- return eObject.eInvoke(operationID, arguments);
- }
-
- @Override
- public int hashCode() {
- return eObject.hashCode();
- }
-}
diff --git a/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EditSupportSpec.java b/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EditSupportSpec.java
index 7ae6b2ec0c..62548f4068 100644
--- a/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EditSupportSpec.java
+++ b/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/EditSupportSpec.java
@@ -10,13 +10,6 @@
*******************************************************************************/
package org.eclipse.sirius.ui.properties.internal;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
import org.eclipse.eef.common.api.utils.Util;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
@@ -24,7 +17,6 @@ import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.sirius.ext.base.Option;
import org.eclipse.sirius.ext.emf.edit.EditingDomainServices;
@@ -36,6 +28,38 @@ import org.eclipse.sirius.properties.impl.EditSupportImpl;
* @author pcdavid
*/
public class EditSupportSpec extends EditSupportImpl {
+ private static final String JAVA_LANG_STRING = "java.lang.String"; //$NON-NLS-1$
+
+ private static final String INT = "int"; //$NON-NLS-1$
+
+ private static final String JAVA_LANG_INTEGER = "java.lang.Integer"; //$NON-NLS-1$
+
+ private static final String DOUBLE = "double"; //$NON-NLS-1$
+
+ private static final String JAVA_LANG_DOUBLE = "java.lang.Double"; //$NON-NLS-1$
+
+ private static final String CHAR = "char"; //$NON-NLS-1$
+
+ private static final String JAVA_LANG_CHARACTER = "java.lang.Character"; //$NON-NLS-1$
+
+ private static final String SHORT = "short"; //$NON-NLS-1$
+
+ private static final String JAVA_LANG_SHORT = "java.lang.Short"; //$NON-NLS-1$
+
+ private static final String LONG = "long"; //$NON-NLS-1$
+
+ private static final String JAVA_LANG_LONG = "java.lang.Long"; //$NON-NLS-1$
+
+ private static final String FLOAT = "float"; //$NON-NLS-1$
+
+ private static final String JAVA_LANG_FLOAT = "java.lang.Float"; //$NON-NLS-1$
+
+ private static final String JAVA_UTIL_DATE = "java.util.Date"; //$NON-NLS-1$
+
+ private static final String BOOLEAN = "boolean"; //$NON-NLS-1$
+
+ private static final String JAVA_LANG_BOOLEAN = "java.lang.Boolean"; //$NON-NLS-1$
+
private final EditingDomainServices editServices = new EditingDomainServices();
private final SiriusContext context;
@@ -65,9 +89,7 @@ public class EditSupportSpec extends EditSupportImpl {
*/
private EObject getTargetEObject() {
EObject result = null;
- if (self instanceof EEFViewCategory) {
- result = ((EEFViewCategory) self).getWrappedEObject();
- } else if (self instanceof EObject) {
+ if (self instanceof EObject) {
result = (EObject) self;
}
return result;
@@ -159,98 +181,48 @@ public class EditSupportSpec extends EditSupportImpl {
}
@Override
- public String getCategory() {
- if (self instanceof EEFViewCategory) {
- return ((EEFViewCategory) self).getCategory();
- } else {
- return Messages.SiriusToolServices_DefaultCategoryName;
- }
+ public boolean needsTextWidget(EStructuralFeature eStructuralFeature) {
+ boolean needsTextWidget = false;
+
+ needsTextWidget = needsTextWidget || JAVA_LANG_STRING.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || INT.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || JAVA_LANG_INTEGER.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || DOUBLE.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || JAVA_LANG_DOUBLE.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || CHAR.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || JAVA_LANG_CHARACTER.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || SHORT.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || JAVA_LANG_SHORT.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || LONG.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || JAVA_LANG_LONG.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || FLOAT.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || JAVA_LANG_FLOAT.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsTextWidget = needsTextWidget || JAVA_UTIL_DATE.equals(eStructuralFeature.getEType().getInstanceTypeName());
+
+ return needsTextWidget && !eStructuralFeature.isMany();
}
@Override
- public EList<EObject> getCategories() {
- if (self instanceof EObject) {
- EObject eObject = (EObject) self;
- EList<EObject> categories = new BasicEList<>();
-
- // Get all the visible features associated to an eObject
- Collection<EStructuralFeature> features = getVisibleEStructuralFeatures(eObject);
-
- // Get all the categories defined in the genmodel for all the
- // features
- // of the given EObject
- Set<String> propertyDescriptorCategories = new HashSet<String>();
- String defaultCategoryName = Messages.SiriusToolServices_DefaultCategoryName;
- for (EStructuralFeature feature : features) {
- String category = this.editServices.getPropertyDescriptorCategory(eObject, feature.getName(), defaultCategoryName);
- if (category != null) {
- propertyDescriptorCategories.add(category);
- } else {
- propertyDescriptorCategories.add(defaultCategoryName);
- }
- }
-
- // Sort the categories by alphabetical order
- List<String> sortedPropertyDescriptorCategories = new ArrayList<String>(propertyDescriptorCategories);
- Collections.sort(sortedPropertyDescriptorCategories);
-
- // Put the default category at the end of the list
- if (sortedPropertyDescriptorCategories.contains(defaultCategoryName)) {
- sortedPropertyDescriptorCategories.remove(defaultCategoryName);
- sortedPropertyDescriptorCategories.add(defaultCategoryName);
- }
+ public boolean needsCheckboxWidget(EStructuralFeature eStructuralFeature) {
+ boolean needsCheckboxWidget = false;
- // Create the EObjects associated to the visible categories
- for (String category : sortedPropertyDescriptorCategories) {
- if (eObject instanceof InternalEObject) {
- EEFViewCategory eefViewCategory = new EEFViewCategory((InternalEObject) eObject, category);
- categories.add(eefViewCategory);
- }
- }
+ needsCheckboxWidget = needsCheckboxWidget || BOOLEAN.equals(eStructuralFeature.getEType().getInstanceTypeName());
+ needsCheckboxWidget = needsCheckboxWidget || JAVA_LANG_BOOLEAN.equals(eStructuralFeature.getEType().getInstanceTypeName());
- return categories;
- } else {
- return new BasicEList<EObject>();
- }
- }
-
- /**
- * Compute all the visible features (not derived, not transient, not a
- * containment reference) associated to a given EObject.
- *
- * @param eObject
- * The EObject
- * @return List of visible features.
- */
- private Collection<EStructuralFeature> getVisibleEStructuralFeatures(EObject eObject) {
- List<EStructuralFeature> visibleFeaturesCache = new ArrayList<EStructuralFeature>();
- for (EStructuralFeature eStructuralFeature : eObject.eClass().getEAllStructuralFeatures()) {
- if (!eStructuralFeature.isDerived() && !eStructuralFeature.isTransient() && !(eStructuralFeature instanceof EReference && ((EReference) eStructuralFeature).isContainment())) {
- visibleFeaturesCache.add(eStructuralFeature);
- }
- }
-
- return visibleFeaturesCache;
+ return needsCheckboxWidget && !eStructuralFeature.isMany();
}
@Override
public EList<EStructuralFeature> getEStructuralFeatures() {
- EList<EStructuralFeature> result = new BasicEList<EStructuralFeature>();
- // Get all the features associated to the eObject and filtered by
- // category
- if (self instanceof EEFViewCategory) {
- EEFViewCategory category = (EEFViewCategory) self;
- String groupCategory = category.getCategory();
- for (EStructuralFeature eStructuralFeature : getVisibleEStructuralFeatures(category.getWrappedEObject())) {
- String featureCategory = this.editServices.getPropertyDescriptorCategory(category.getWrappedEObject(), eStructuralFeature.getName(), Messages.SiriusToolServices_DefaultCategoryName);
- if (groupCategory.equals(featureCategory)) {
- result.add(eStructuralFeature);
- }
+ EList<EStructuralFeature> visibleFeatures = new BasicEList<>();
+ for (EStructuralFeature eStructuralFeature : this.getTargetEObject().eClass().getEAllStructuralFeatures()) {
+ if (!eStructuralFeature.isDerived() && !eStructuralFeature.isTransient() && !(eStructuralFeature instanceof EReference && ((EReference) eStructuralFeature).isContainment())) {
+ visibleFeatures.add(eStructuralFeature);
}
}
- return result;
+ return visibleFeatures;
}
-
+
@Override
public Object setValue(EStructuralFeature feature, Object newValue) {
EObject target = getTargetEObject();

Back to the top