diff options
| author | Mélanie Bats | 2016-09-21 13:06:45 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2016-09-22 13:36:21 +0000 |
| commit | 81c93156c8d32579562139fe83878eb47db53e58 (patch) | |
| tree | 1bfaca8fe7b1208c5d2c60e72e9c6fd60f3f2cb4 | |
| parent | 6e95e49b0319bf0ed34fbd24c3f2bb44f0d90906 (diff) | |
| download | org.eclipse.sirius-81c93156c8d32579562139fe83878eb47db53e58.tar.gz org.eclipse.sirius-81c93156c8d32579562139fe83878eb47db53e58.tar.xz org.eclipse.sirius-81c93156c8d32579562139fe83878eb47db53e58.zip | |
[496058] Use the new list widget in default rules for multi-valued features
Bug: 496058
Change-Id: Ie77a5ee4dfddb11777b69c5ef87e13288afb5619
Signed-off-by: Mélanie Bats <melanie.bats@obeo.fr>
2 files changed, 24 insertions, 76 deletions
diff --git a/plugins/org.eclipse.sirius.ui.properties/model/properties.odesign b/plugins/org.eclipse.sirius.ui.properties/model/properties.odesign index 41b8f79ee2..4aef0180fa 100644 --- a/plugins/org.eclipse.sirius.ui.properties/model/properties.odesign +++ b/plugins/org.eclipse.sirius.ui.properties/model/properties.odesign @@ -1,34 +1,12 @@ <?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" - xsi:schemaLocation="http://www.eclipse.org/sirius/properties/1.0.0 ../../org.eclipse.sirius.properties/model/properties.ecore http://www.eclipse.org/sirius/properties/1.0.0/ext/widgets/reference ../../org.eclipse.sirius.properties.ext.widgets.reference/model/properties-ext-widgets-reference.ecore" - identifier="org.eclipse.sirius.ui.properties"> - <pages identifier="org.eclipse.sirius.ui.properties.defaultpage" - labelExpression="General" - groups="//@groups.0"/> - <groups identifier="org.eclipse.sirius.ui.properties.defaultgroup" - labelExpression="aql:self.eefViewCategory()" - semanticCandidateExpression="aql:self.eefViewCategories()" - preconditionExpression=""> - <controls - xsi:type="properties:DynamicMappingFor" - iterator="eStructuralFeature" - domainClassExpression="aql:self.eefViewEStructuralFeatures()"> +<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" identifier="org.eclipse.sirius.ui.properties"> + <pages identifier="org.eclipse.sirius.ui.properties.defaultpage" labelExpression="General" groups="//@groups.0"/> + <groups identifier="org.eclipse.sirius.ui.properties.defaultgroup" labelExpression="aql:self.eefViewCategory()" semanticCandidateExpression="aql:self.eefViewCategories()" preconditionExpression=""> + <controls xsi:type="properties:DynamicMappingFor" iterator="eStructuralFeature" iterableExpression="aql:self.eefViewEStructuralFeatures()"> <ifs predicateExpression="aql:(eStructuralFeature.eType.instanceTypeName = 'java.lang.String' or eStructuralFeature.eType.instanceTypeName = 'int' or eStructuralFeature.eType.instanceTypeName = 'double' or eStructuralFeature.eType.instanceTypeName = 'char' or eStructuralFeature.eType.instanceTypeName = 'short' or eStructuralFeature.eType.instanceTypeName = 'long' or eStructuralFeature.eType.instanceTypeName = 'float' or eStructuralFeature.eType.instanceTypeName = 'java.util.Date') and not(eStructuralFeature.many) and not self.eefViewMultiline(eStructuralFeature)"> - <widget - xsi:type="properties:TextDescription" - identifier="sirius_default_rules_mono_string" - labelExpression="aql:self.eefViewText(eStructuralFeature)+':'" - helpExpression="aql:self.eefViewDescription(eStructuralFeature)" - isEnabledExpression="aql:eStructuralFeature.changeable" - valueExpression="aql:self.eGet(eStructuralFeature)"> + <widget xsi:type="properties:TextDescription" identifier="sirius_default_rules_mono_string" labelExpression="aql:self.eefViewText(eStructuralFeature)+':'" helpExpression="aql:self.eefViewDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature)"> <initialOperation/> - <conditionalStyles - preconditionExpression="aql:eStructuralFeature.lowerBound==1"> + <conditionalStyles preconditionExpression="aql:eStructuralFeature.lowerBound==1"> <style> <labelFontFormat>bold</labelFontFormat> </style> @@ -36,16 +14,9 @@ </widget> </ifs> <ifs predicateExpression="aql:(eStructuralFeature.eType.instanceTypeName = 'java.lang.String' or eStructuralFeature.eType.instanceTypeName = 'int' or eStructuralFeature.eType.instanceTypeName = 'double' or eStructuralFeature.eType.instanceTypeName = 'char' or eStructuralFeature.eType.instanceTypeName = 'short' or eStructuralFeature.eType.instanceTypeName = 'long' or eStructuralFeature.eType.instanceTypeName = 'float' or eStructuralFeature.eType.instanceTypeName = 'java.util.Date') and not(eStructuralFeature.many) and self.eefViewMultiline(eStructuralFeature)"> - <widget - xsi:type="properties:TextAreaDescription" - identifier="sirius_default_rules_multi_string" - labelExpression="aql:self.eefViewText(eStructuralFeature)+':'" - helpExpression="aql:self.eefViewDescription(eStructuralFeature)" - isEnabledExpression="aql:eStructuralFeature.changeable" - valueExpression="aql:self.eGet(eStructuralFeature)"> + <widget xsi:type="properties:TextAreaDescription" identifier="sirius_default_rules_multi_string" labelExpression="aql:self.eefViewText(eStructuralFeature)+':'" helpExpression="aql:self.eefViewDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature)"> <initialOperation/> - <conditionalStyles - preconditionExpression="aql:eStructuralFeature.lowerBound==1"> + <conditionalStyles preconditionExpression="aql:eStructuralFeature.lowerBound==1"> <style> <labelFontFormat>bold</labelFontFormat> </style> @@ -53,16 +24,9 @@ </widget> </ifs> <ifs predicateExpression="aql:(eStructuralFeature.eType.instanceTypeName = 'java.lang.Boolean' or eStructuralFeature.eType.instanceTypeName = 'boolean') and not(eStructuralFeature.many)"> - <widget - xsi:type="properties:CheckboxDescription" - identifier="sirius_default_rules_mono_boolean" - labelExpression="aql:self.eefViewText(eStructuralFeature)" - helpExpression="aql:self.eefViewDescription(eStructuralFeature)" - isEnabledExpression="aql:eStructuralFeature.changeable" - valueExpression="aql:self.eGet(eStructuralFeature)"> + <widget xsi:type="properties:CheckboxDescription" identifier="sirius_default_rules_mono_boolean" labelExpression="aql:self.eefViewText(eStructuralFeature)" helpExpression="aql:self.eefViewDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature)"> <initialOperation/> - <conditionalStyles - preconditionExpression="aql:eStructuralFeature.lowerBound==1"> + <conditionalStyles preconditionExpression="aql:eStructuralFeature.lowerBound==1"> <style> <labelFontFormat>bold</labelFontFormat> </style> @@ -70,19 +34,9 @@ </widget> </ifs> <ifs predicateExpression="aql:eStructuralFeature.eType.oclIsKindOf(ecore::EEnum) and not(eStructuralFeature.many)"> - <widget - xsi:type="properties:RadioDescription" - identifier="sirius_default_rules_enum" - labelExpression="aql:self.eefViewText(eStructuralFeature)+':'" - helpExpression="aql:self.eefViewDescription(eStructuralFeature)" - isEnabledExpression="aql:eStructuralFeature.changeable" - valueExpression="aql:eStructuralFeature.eType.getEEnumLiteral(self.eGet(eStructuralFeature).toString())" - candidatesExpression="aql:eStructuralFeature.eType.eLiterals" - candidateDisplayExpression="aql:candidate.name" - numberOfColumns="5"> + <widget xsi:type="properties:RadioDescription" identifier="sirius_default_rules_enum" labelExpression="aql:self.eefViewText(eStructuralFeature)+':'" helpExpression="aql:self.eefViewDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:eStructuralFeature.eType.getEEnumLiteral(self.eGet(eStructuralFeature).toString())" candidatesExpression="aql:eStructuralFeature.eType.eLiterals" candidateDisplayExpression="aql:candidate.name" numberOfColumns="5"> <initialOperation/> - <conditionalStyles - preconditionExpression="aql:eStructuralFeature.lowerBound==1"> + <conditionalStyles preconditionExpression="aql:eStructuralFeature.lowerBound==1"> <style> <labelFontFormat>bold</labelFontFormat> </style> @@ -90,22 +44,13 @@ </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:self.eefViewText(eStructuralFeature)+':'" - helpExpression="aql:self.eefViewDescription(eStructuralFeature)" - isEnabledExpression="aql:eStructuralFeature.changeable" - referenceNameExpression="aql:eStructuralFeature.name"/> + <widget xsi:type="properties-ext-widgets-reference:ExtReferenceDescription" identifier="sirius_default_rules_mono_noncontainment_reference" labelExpression="aql:self.eefViewText(eStructuralFeature)+':'" helpExpression="aql:self.eefViewDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" referenceNameExpression="aql:eStructuralFeature.name"/> </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:self.eefViewText(eStructuralFeature)+':'" - helpExpression="aql:self.eefViewDescription(eStructuralFeature)" - isEnabledExpression="aql:eStructuralFeature.changeable" - referenceNameExpression="aql:eStructuralFeature.name"/> + <widget xsi:type="properties-ext-widgets-reference:ExtReferenceDescription" identifier="sirius_default_rules_multi_noncontainment_reference" labelExpression="aql:self.eefViewText(eStructuralFeature)+':'" helpExpression="aql:self.eefViewDescription(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:self.eefViewText(eStructuralFeature)+':'" helpExpression="aql:self.eefViewDescription(eStructuralFeature)" isEnabledExpression="aql:eStructuralFeature.changeable" valueExpression="aql:self.eGet(eStructuralFeature)" displayExpression="aql:value.eefViewText()"/> </ifs> </controls> </groups> diff --git a/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusToolServices.java b/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusToolServices.java index 3feb27117a..f495286949 100644 --- a/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusToolServices.java +++ b/plugins/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusToolServices.java @@ -75,13 +75,16 @@ public class SiriusToolServices { /** * Returns the text representing the given EObject. * - * @param eObject - * The EObject + * @param object + * The object * @return The text representing the given EObject or <code>null</code> if * none could be found */ - public String eefViewText(EObject eObject) { - return this.editServices.getLabelProviderText(eObject); + public String eefViewText(Object object) { + if (object instanceof EObject) { + return this.editServices.getLabelProviderText((EObject) object); + } + return String.valueOf(object); } /** |
