Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Charles David2016-05-20 13:57:52 +0000
committerPierre-Charles David2016-05-20 13:57:52 +0000
commit0025693055338395f3270824ffc9825117321b82 (patch)
tree5918cfc9cc0202d038e8bfc276d700a02a85c316
parentfdd417cb869f7a4bcdc2890556c22dc39bcaa71b (diff)
downloadorg.eclipse.sirius-0025693055338395f3270824ffc9825117321b82.tar.gz
org.eclipse.sirius-0025693055338395f3270824ffc9825117321b82.tar.xz
org.eclipse.sirius-0025693055338395f3270824ffc9825117321b82.zip
[482528] Fix widgets used for some property sections
The generator used is sensible to the way EDatatypes from Ecore are referenced, and failed to detect the proper type of widget to use in some cases. Bug: 482528 Change-Id: Idb479cfdcbeb7601ed44b4c84d668237c555349a Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
-rw-r--r--incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection.java66
-rw-r--r--incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionNumberOfColumnsPropertySection.java70
-rw-r--r--incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/radiodescription/RadioDescriptionNumberOfColumnsPropertySection.java70
-rw-r--r--incubation/org.eclipse.sirius.properties/model/properties.ecore12
4 files changed, 134 insertions, 84 deletions
diff --git a/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection.java b/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection.java
index 2cf8c8da3f..9d4d49b287 100644
--- a/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection.java
+++ b/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection.java
@@ -10,7 +10,7 @@
package org.eclipse.sirius.properties.editor.properties.sections.properties.gridlayoutdescription;
import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.sirius.editor.properties.sections.common.AbstractTextPropertySection;
+import org.eclipse.sirius.editor.properties.sections.common.AbstractCheckBoxPropertySection;
import org.eclipse.sirius.properties.PropertiesPackage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
@@ -21,10 +21,9 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* A section for the makeColumnsWithEqualWidth property of a
* GridLayoutDescription object.
*/
-public class GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection extends AbstractTextPropertySection {
-
+public class GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection extends AbstractCheckBoxPropertySection {
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getDefaultLabelText()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractCheckBoxPropertySection#getDefaultLabelText()
*/
@Override
protected String getDefaultLabelText() {
@@ -32,7 +31,7 @@ public class GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection exten
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getLabelText()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractCheckBoxPropertySection#getLabelText()
*/
@Override
protected String getLabelText() {
@@ -45,51 +44,66 @@ public class GridLayoutDescriptionMakeColumnsWithEqualWidthPropertySection exten
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getFeature()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractCheckBoxPropertySection#getFeature()
*/
@Override
- public EAttribute getFeature() {
+ protected EAttribute getFeature() {
return PropertiesPackage.eINSTANCE.getGridLayoutDescription_MakeColumnsWithEqualWidth();
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getFeatureValue(String)
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractCheckBoxPropertySection#getFeatureAsInteger()
*/
@Override
- protected Object getFeatureValue(String newText) {
- return newText;
+ protected String getDefaultFeatureAsText() {
+ String value = new String();
+ if (eObject.eGet(getFeature()) != null) {
+ value = toBoolean(eObject.eGet(getFeature()).toString()).toString();
+ }
+ return value;
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#isEqual(String)
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractCheckBoxPropertySection#getFeatureValue(int)
*/
@Override
- protected boolean isEqual(String newText) {
- return getFeatureAsText().equals(newText);
+ protected Object getFeatureValue(String newText) {
+ return toBoolean(newText);
}
/**
- * {@inheritDoc}
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractCheckBoxPropertySection#isEqual(int)
*/
@Override
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
- super.createControls(parent, tabbedPropertySheetPage);
-
- // Start of user code create controls
-
- // End of user code create controls
+ protected boolean isEqual(String newText) {
+ boolean equal = true;
+ if (toBoolean(newText) != null) {
+ equal = getFeatureAsText().equals(toBoolean(newText).toString());
+ } else {
+ refresh();
+ }
+ return equal;
+ }
+ /**
+ * Converts the given text to the boolean it represents if applicable.
+ *
+ * @return The boolean the given text represents if applicable,
+ * <code>null</code> otherwise.
+ */
+ private Boolean toBoolean(String text) {
+ Boolean booleanValue = null;
+ if (text.toLowerCase().matches("true|false")) {
+ booleanValue = Boolean.parseBoolean(text);
+ }
+ return booleanValue;
}
/**
* {@inheritDoc}
*/
@Override
- protected String getPropertyDescription() {
- return "";
+ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
+ super.createControls(parent, tabbedPropertySheetPage);
}
-
- // Start of user code user operations
-
- // End of user code user operations
}
diff --git a/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionNumberOfColumnsPropertySection.java b/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionNumberOfColumnsPropertySection.java
index 74a2d513ae..3f2f0f33b8 100644
--- a/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionNumberOfColumnsPropertySection.java
+++ b/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/gridlayoutdescription/GridLayoutDescriptionNumberOfColumnsPropertySection.java
@@ -10,20 +10,17 @@
package org.eclipse.sirius.properties.editor.properties.sections.properties.gridlayoutdescription;
import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.sirius.editor.properties.sections.common.AbstractTextPropertySection;
+import org.eclipse.sirius.editor.properties.sections.common.AbstractSpinnerPropertySection;
import org.eclipse.sirius.properties.PropertiesPackage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-// End of user code imports
-
/**
* A section for the numberOfColumns property of a GridLayoutDescription object.
*/
-public class GridLayoutDescriptionNumberOfColumnsPropertySection extends AbstractTextPropertySection {
-
+public class GridLayoutDescriptionNumberOfColumnsPropertySection extends AbstractSpinnerPropertySection {
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getDefaultLabelText()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getDefaultLabelText()
*/
@Override
protected String getDefaultLabelText() {
@@ -31,7 +28,7 @@ public class GridLayoutDescriptionNumberOfColumnsPropertySection extends Abstrac
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getLabelText()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getLabelText()
*/
@Override
protected String getLabelText() {
@@ -44,51 +41,72 @@ public class GridLayoutDescriptionNumberOfColumnsPropertySection extends Abstrac
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getFeature()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getFeature()
*/
@Override
- public EAttribute getFeature() {
+ protected EAttribute getFeature() {
return PropertiesPackage.eINSTANCE.getGridLayoutDescription_NumberOfColumns();
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getFeatureValue(String)
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getFeatureAsInteger()
*/
@Override
- protected Object getFeatureValue(String newText) {
- return newText;
+ protected String getFeatureAsText() {
+ String value = new String();
+ if (eObject.eGet(getFeature()) != null) {
+ value = toInteger(eObject.eGet(getFeature()).toString()).toString();
+ }
+ return value;
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#isEqual(String)
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#isEqual(int)
*/
@Override
protected boolean isEqual(String newText) {
- return getFeatureAsText().equals(newText);
+ boolean equal = true;
+ if (toInteger(newText) != null) {
+ equal = getFeatureAsText().equals(toInteger(newText).toString());
+ } else {
+ refresh();
+ }
+ return equal;
}
/**
- * {@inheritDoc}
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getFeatureValue(int)
*/
@Override
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
- super.createControls(parent, tabbedPropertySheetPage);
-
- // Start of user code create controls
-
- // End of user code create controls
+ protected Object getFeatureValue(String newText) {
+ return toInteger(newText);
+ }
+ /**
+ * Converts the given text to the integer it represents if applicable.
+ *
+ * @return The integer the given text represents if applicable,
+ * <code>null</code> otherwise.
+ */
+ private Integer toInteger(String text) {
+ Integer integerValue = null;
+ try {
+ integerValue = new Integer(text);
+ } catch (NumberFormatException e) {
+ // Not a Integer
+ }
+ return integerValue;
}
/**
* {@inheritDoc}
*/
@Override
- protected String getPropertyDescription() {
- return "";
- }
+ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
+ super.createControls(parent, tabbedPropertySheetPage);
- // Start of user code user operations
+ // Start of user code create controls
- // End of user code user operations
+ // End of user code create controls
+ }
}
diff --git a/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/radiodescription/RadioDescriptionNumberOfColumnsPropertySection.java b/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/radiodescription/RadioDescriptionNumberOfColumnsPropertySection.java
index e38fccdf72..e31968e9ce 100644
--- a/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/radiodescription/RadioDescriptionNumberOfColumnsPropertySection.java
+++ b/incubation/org.eclipse.sirius.editor.properties/src-gen/org/eclipse/sirius/properties/editor/properties/sections/properties/radiodescription/RadioDescriptionNumberOfColumnsPropertySection.java
@@ -10,20 +10,17 @@
package org.eclipse.sirius.properties.editor.properties.sections.properties.radiodescription;
import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.sirius.editor.properties.sections.common.AbstractTextPropertySection;
+import org.eclipse.sirius.editor.properties.sections.common.AbstractSpinnerPropertySection;
import org.eclipse.sirius.properties.PropertiesPackage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-// End of user code imports
-
/**
* A section for the numberOfColumns property of a RadioDescription object.
*/
-public class RadioDescriptionNumberOfColumnsPropertySection extends AbstractTextPropertySection {
-
+public class RadioDescriptionNumberOfColumnsPropertySection extends AbstractSpinnerPropertySection {
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getDefaultLabelText()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getDefaultLabelText()
*/
@Override
protected String getDefaultLabelText() {
@@ -31,7 +28,7 @@ public class RadioDescriptionNumberOfColumnsPropertySection extends AbstractText
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getLabelText()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getLabelText()
*/
@Override
protected String getLabelText() {
@@ -44,51 +41,72 @@ public class RadioDescriptionNumberOfColumnsPropertySection extends AbstractText
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getFeature()
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getFeature()
*/
@Override
- public EAttribute getFeature() {
+ protected EAttribute getFeature() {
return PropertiesPackage.eINSTANCE.getRadioDescription_NumberOfColumns();
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#getFeatureValue(String)
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getFeatureAsInteger()
*/
@Override
- protected Object getFeatureValue(String newText) {
- return newText;
+ protected String getFeatureAsText() {
+ String value = new String();
+ if (eObject.eGet(getFeature()) != null) {
+ value = toInteger(eObject.eGet(getFeature()).toString()).toString();
+ }
+ return value;
}
/**
- * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractTextPropertySection#isEqual(String)
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#isEqual(int)
*/
@Override
protected boolean isEqual(String newText) {
- return getFeatureAsText().equals(newText);
+ boolean equal = true;
+ if (toInteger(newText) != null) {
+ equal = getFeatureAsText().equals(toInteger(newText).toString());
+ } else {
+ refresh();
+ }
+ return equal;
}
/**
- * {@inheritDoc}
+ * @see org.eclipse.sirius.properties.editor.properties.sections.AbstractSpinnerPropertySection#getFeatureValue(int)
*/
@Override
- public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
- super.createControls(parent, tabbedPropertySheetPage);
-
- // Start of user code create controls
-
- // End of user code create controls
+ protected Object getFeatureValue(String newText) {
+ return toInteger(newText);
+ }
+ /**
+ * Converts the given text to the integer it represents if applicable.
+ *
+ * @return The integer the given text represents if applicable,
+ * <code>null</code> otherwise.
+ */
+ private Integer toInteger(String text) {
+ Integer integerValue = null;
+ try {
+ integerValue = new Integer(text);
+ } catch (NumberFormatException e) {
+ // Not a Integer
+ }
+ return integerValue;
}
/**
* {@inheritDoc}
*/
@Override
- protected String getPropertyDescription() {
- return "";
- }
+ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
+ super.createControls(parent, tabbedPropertySheetPage);
- // Start of user code user operations
+ // Start of user code create controls
- // End of user code user operations
+ // End of user code create controls
+ }
}
diff --git a/incubation/org.eclipse.sirius.properties/model/properties.ecore b/incubation/org.eclipse.sirius.properties/model/properties.ecore
index 4a6ee38836..0d4ec889ba 100644
--- a/incubation/org.eclipse.sirius.properties/model/properties.ecore
+++ b/incubation/org.eclipse.sirius.properties/model/properties.ecore
@@ -71,10 +71,10 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="orientation" eType="#//FILL_LAYOUT_ORIENTATION"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GridLayoutDescription" eSuperTypes="#//LayoutDescription">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="numberOfColumns" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="numberOfColumns" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="makeColumnsWithEqualWidth"
- eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="FILL_LAYOUT_ORIENTATION">
<eLiterals name="VERTICAL" literal="VERTICAL"/>
@@ -157,15 +157,15 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DynamicMappingFor" eSuperTypes="#//ControlDescription">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="iterator" lowerBound="1"
- eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="domainClassExpression"
- lowerBound="1" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ifs" lowerBound="1" upperBound="-1"
eType="#//DynamicMappingIf" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="DynamicMappingIf">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="predicateExpression" lowerBound="1"
- eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="widget" lowerBound="1"
eType="#//WidgetDescription" containment="true"/>
</eClassifiers>
@@ -205,7 +205,7 @@
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EReference" name="style" eType="#//RadioWidgetStyle"
containment="true"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="numberOfColumns" eType="ecore:EDataType ../../org.eclipse.emf.ecore/model/Ecore.ecore#//EInt"
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="numberOfColumns" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="-1">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The number of columns to use to display the candidates."/>

Back to the top