Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-01-10 13:15:00 -0500
committeratikhomirov2006-01-10 13:15:00 -0500
commita1661f8715f8c6e9f8d90c98d6fe0fcce927f9e9 (patch)
tree1526aabbf20cb6a5bb759752f3f22f49be2a8828
parentfb523ba8b7faec05c8ccac41ad57a66483eff580 (diff)
downloadorg.eclipse.gmf-tooling-a1661f8715f8c6e9f8d90c98d6fe0fcce927f9e9.tar.gz
org.eclipse.gmf-tooling-a1661f8715f8c6e9f8d90c98d6fe0fcce927f9e9.tar.xz
org.eclipse.gmf-tooling-a1661f8715f8c6e9f8d90c98d6fe0fcce927f9e9.zip
multiple values in the generic style selector
-rw-r--r--plugins/org.eclipse.gmf.tooldef.edit/plugin.properties3
-rw-r--r--plugins/org.eclipse.gmf.tooldef.edit/src/org/eclipse/gmf/tooldef/provider/GenericStyleSelectorItemProvider.java20
-rw-r--r--plugins/org.eclipse.gmf.tooldef/models/tooldef.ecore3
-rw-r--r--plugins/org.eclipse.gmf.tooldef/models/tooldef.genmodel2
-rw-r--r--plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GMFToolPackage.java12
-rw-r--r--plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GenericStyleSelector.java29
-rw-r--r--plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GMFToolPackageImpl.java8
-rw-r--r--plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GenericStyleSelectorImpl.java75
-rw-r--r--tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ToolDefHandocodedImplTest.java28
9 files changed, 87 insertions, 93 deletions
diff --git a/plugins/org.eclipse.gmf.tooldef.edit/plugin.properties b/plugins/org.eclipse.gmf.tooldef.edit/plugin.properties
index dd0a8c1a9..16f9fa393 100644
--- a/plugins/org.eclipse.gmf.tooldef.edit/plugin.properties
+++ b/plugins/org.eclipse.gmf.tooldef.edit/plugin.properties
@@ -131,4 +131,5 @@ _UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1
_UI_Wizard_initial_object_description = Select a model object to create
_UI_FileConflict_label = File Conflict
_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes?
- \ No newline at end of file
+
+_UI_GenericStyleSelector_values_feature = Values
diff --git a/plugins/org.eclipse.gmf.tooldef.edit/src/org/eclipse/gmf/tooldef/provider/GenericStyleSelectorItemProvider.java b/plugins/org.eclipse.gmf.tooldef.edit/src/org/eclipse/gmf/tooldef/provider/GenericStyleSelectorItemProvider.java
index 68a8717f6..0b5375cef 100644
--- a/plugins/org.eclipse.gmf.tooldef.edit/src/org/eclipse/gmf/tooldef/provider/GenericStyleSelectorItemProvider.java
+++ b/plugins/org.eclipse.gmf.tooldef.edit/src/org/eclipse/gmf/tooldef/provider/GenericStyleSelectorItemProvider.java
@@ -11,9 +11,7 @@ import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
-
import org.eclipse.emf.common.util.ResourceLocator;
-
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
@@ -23,8 +21,6 @@ import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
-
-import org.eclipse.gmf.tooldef.AppearanceStyle;
import org.eclipse.gmf.tooldef.GMFToolPackage;
import org.eclipse.gmf.tooldef.GenericStyleSelector;
@@ -56,21 +52,21 @@ public class GenericStyleSelectorItemProvider extends ItemProviderAdapter implem
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
- addValuePropertyDescriptor(object);
+ addValuesPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
- * This adds a property descriptor for the Value feature.
+ * This adds a property descriptor for the Values feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected void addValuePropertyDescriptor(Object object) {
+ protected void addValuesPropertyDescriptor(Object object) {
itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(),
- getString("_UI_GenericStyleSelector_value_feature"), getString("_UI_PropertyDescriptor_description", "_UI_GenericStyleSelector_value_feature", "_UI_GenericStyleSelector_type"),
- GMFToolPackage.eINSTANCE.getGenericStyleSelector_Value(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ getString("_UI_GenericStyleSelector_values_feature"), getString("_UI_PropertyDescriptor_description", "_UI_GenericStyleSelector_values_feature", "_UI_GenericStyleSelector_type"),
+ GMFToolPackage.eINSTANCE.getGenericStyleSelector_Values(), true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
@@ -90,9 +86,7 @@ public class GenericStyleSelectorItemProvider extends ItemProviderAdapter implem
* @generated
*/
public String getText(Object object) {
- AppearanceStyle labelValue = ((GenericStyleSelector) object).getValue();
- String label = labelValue == null ? null : labelValue.toString();
- return label == null || label.length() == 0 ? getString("_UI_GenericStyleSelector_type") : getString("_UI_GenericStyleSelector_type") + " " + label;
+ return getString("_UI_GenericStyleSelector_type");
}
/**
@@ -106,7 +100,7 @@ public class GenericStyleSelectorItemProvider extends ItemProviderAdapter implem
updateChildren(notification);
switch (notification.getFeatureID(GenericStyleSelector.class)) {
- case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUE:
+ case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUES:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
diff --git a/plugins/org.eclipse.gmf.tooldef/models/tooldef.ecore b/plugins/org.eclipse.gmf.tooldef/models/tooldef.ecore
index 5968f5105..4da7de4cf 100644
--- a/plugins/org.eclipse.gmf.tooldef/models/tooldef.ecore
+++ b/plugins/org.eclipse.gmf.tooldef/models/tooldef.ecore
@@ -114,7 +114,8 @@
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="GenericStyleSelector" eSuperTypes="#//StyleSelector">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="#//AppearanceStyle"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="values" lowerBound="1"
+ upperBound="-1" eType="#//AppearanceStyle"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="AppearanceStyle">
<eLiterals name="Font"/>
diff --git a/plugins/org.eclipse.gmf.tooldef/models/tooldef.genmodel b/plugins/org.eclipse.gmf.tooldef/models/tooldef.genmodel
index 663c89f07..fe74fbc23 100644
--- a/plugins/org.eclipse.gmf.tooldef/models/tooldef.genmodel
+++ b/plugins/org.eclipse.gmf.tooldef/models/tooldef.genmodel
@@ -101,7 +101,7 @@
</genOperations>
</genClasses>
<genClasses ecoreClass="tooldef.ecore#//GenericStyleSelector">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute tooldef.ecore#//GenericStyleSelector/value"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute tooldef.ecore#//GenericStyleSelector/values"/>
</genClasses>
</genPackages>
</genmodel:GenModel>
diff --git a/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GMFToolPackage.java b/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GMFToolPackage.java
index ab6e14fc5..756b61a79 100644
--- a/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GMFToolPackage.java
+++ b/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GMFToolPackage.java
@@ -1140,13 +1140,13 @@ public interface GMFToolPackage extends EPackage {
int GENERIC_STYLE_SELECTOR = 25;
/**
- * The feature id for the '<em><b>Value</b></em>' attribute.
+ * The feature id for the '<em><b>Values</b></em>' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int GENERIC_STYLE_SELECTOR__VALUE = STYLE_SELECTOR_FEATURE_COUNT + 0;
+ int GENERIC_STYLE_SELECTOR__VALUES = STYLE_SELECTOR_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Generic Style Selector</em>' class.
@@ -1734,15 +1734,15 @@ public interface GMFToolPackage extends EPackage {
EClass getGenericStyleSelector();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.gmf.tooldef.GenericStyleSelector#getValue <em>Value</em>}'.
+ * Returns the meta object for the attribute list '{@link org.eclipse.gmf.tooldef.GenericStyleSelector#getValues <em>Values</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Value</em>'.
- * @see org.eclipse.gmf.tooldef.GenericStyleSelector#getValue()
+ * @return the meta object for the attribute list '<em>Values</em>'.
+ * @see org.eclipse.gmf.tooldef.GenericStyleSelector#getValues()
* @see #getGenericStyleSelector()
* @generated
*/
- EAttribute getGenericStyleSelector_Value();
+ EAttribute getGenericStyleSelector_Values();
/**
* Returns the meta object for enum '{@link org.eclipse.gmf.tooldef.StandardToolKind <em>Standard Tool Kind</em>}'.
diff --git a/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GenericStyleSelector.java b/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GenericStyleSelector.java
index c07bf6f6e..69c68e068 100644
--- a/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GenericStyleSelector.java
+++ b/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/GenericStyleSelector.java
@@ -6,6 +6,8 @@
*/
package org.eclipse.gmf.tooldef;
+import org.eclipse.emf.common.util.EList;
+
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Generic Style Selector</b></em>'.
@@ -14,7 +16,7 @@ package org.eclipse.gmf.tooldef;
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.gmf.tooldef.GenericStyleSelector#getValue <em>Value</em>}</li>
+ * <li>{@link org.eclipse.gmf.tooldef.GenericStyleSelector#getValues <em>Values</em>}</li>
* </ul>
* </p>
*
@@ -24,32 +26,21 @@ package org.eclipse.gmf.tooldef;
*/
public interface GenericStyleSelector extends StyleSelector {
/**
- * Returns the value of the '<em><b>Value</b></em>' attribute.
+ * Returns the value of the '<em><b>Values</b></em>' attribute list.
+ * The list contents are of type {@link org.eclipse.gmf.tooldef.AppearanceStyle}.
* The literals are from the enumeration {@link org.eclipse.gmf.tooldef.AppearanceStyle}.
* <!-- begin-user-doc -->
* <p>
- * If the meaning of the '<em>Value</em>' attribute isn't clear,
+ * If the meaning of the '<em>Values</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Value</em>' attribute.
- * @see org.eclipse.gmf.tooldef.AppearanceStyle
- * @see #setValue(AppearanceStyle)
- * @see org.eclipse.gmf.tooldef.GMFToolPackage#getGenericStyleSelector_Value()
- * @model
- * @generated
- */
- AppearanceStyle getValue();
-
- /**
- * Sets the value of the '{@link org.eclipse.gmf.tooldef.GenericStyleSelector#getValue <em>Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Value</em>' attribute.
+ * @return the value of the '<em>Values</em>' attribute list.
* @see org.eclipse.gmf.tooldef.AppearanceStyle
- * @see #getValue()
+ * @see org.eclipse.gmf.tooldef.GMFToolPackage#getGenericStyleSelector_Values()
+ * @model type="org.eclipse.gmf.tooldef.AppearanceStyle" required="true"
* @generated
*/
- void setValue(AppearanceStyle value);
+ EList getValues();
} // GenericStyleSelector
diff --git a/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GMFToolPackageImpl.java b/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GMFToolPackageImpl.java
index 9dc303c9b..439911469 100644
--- a/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GMFToolPackageImpl.java
+++ b/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GMFToolPackageImpl.java
@@ -800,7 +800,7 @@ public class GMFToolPackageImpl extends EPackageImpl implements GMFToolPackage {
* <!-- end-user-doc -->
* @generated
*/
- public EAttribute getGenericStyleSelector_Value() {
+ public EAttribute getGenericStyleSelector_Values() {
return (EAttribute) genericStyleSelectorEClass.getEStructuralFeatures().get(0);
}
@@ -937,7 +937,7 @@ public class GMFToolPackageImpl extends EPackageImpl implements GMFToolPackage {
styleSelectorEClass = createEClass(STYLE_SELECTOR);
genericStyleSelectorEClass = createEClass(GENERIC_STYLE_SELECTOR);
- createEAttribute(genericStyleSelectorEClass, GENERIC_STYLE_SELECTOR__VALUE);
+ createEAttribute(genericStyleSelectorEClass, GENERIC_STYLE_SELECTOR__VALUES);
// Create enums
standardToolKindEEnum = createEEnum(STANDARD_TOOL_KIND);
@@ -1100,8 +1100,8 @@ public class GMFToolPackageImpl extends EPackageImpl implements GMFToolPackage {
addEParameter(op, ecorePackage.getEJavaObject(), "style", 0, 1);
initEClass(genericStyleSelectorEClass, GenericStyleSelector.class, "GenericStyleSelector", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getGenericStyleSelector_Value(), this.getAppearanceStyle(), "value", null, 0, 1, GenericStyleSelector.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
- IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGenericStyleSelector_Values(), this.getAppearanceStyle(), "values", null, 1, -1, GenericStyleSelector.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE,
+ !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Initialize enums and add enum literals
initEEnum(standardToolKindEEnum, StandardToolKind.class, "StandardToolKind");
diff --git a/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GenericStyleSelectorImpl.java b/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GenericStyleSelectorImpl.java
index 27e6fc517..b6fe61e81 100644
--- a/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GenericStyleSelectorImpl.java
+++ b/plugins/org.eclipse.gmf.tooldef/src/org/eclipse/gmf/tooldef/impl/GenericStyleSelectorImpl.java
@@ -6,14 +6,14 @@
*/
package org.eclipse.gmf.tooldef.impl;
-import org.eclipse.emf.common.notify.Notification;
+import java.util.Collection;
+import java.util.Iterator;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;
-
+import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.gmf.tooldef.AppearanceStyle;
import org.eclipse.gmf.tooldef.GMFToolPackage;
import org.eclipse.gmf.tooldef.GenericStyleSelector;
@@ -25,7 +25,7 @@ import org.eclipse.gmf.tooldef.GenericStyleSelector;
* <p>
* The following features are implemented:
* <ul>
- * <li>{@link org.eclipse.gmf.tooldef.impl.GenericStyleSelectorImpl#getValue <em>Value</em>}</li>
+ * <li>{@link org.eclipse.gmf.tooldef.impl.GenericStyleSelectorImpl#getValues <em>Values</em>}</li>
* </ul>
* </p>
*
@@ -33,24 +33,14 @@ import org.eclipse.gmf.tooldef.GenericStyleSelector;
*/
public class GenericStyleSelectorImpl extends EObjectImpl implements GenericStyleSelector {
/**
- * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getValue()
- * @generated
- * @ordered
- */
- protected static final AppearanceStyle VALUE_EDEFAULT = AppearanceStyle.FONT_LITERAL;
-
- /**
- * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
+ * The cached value of the '{@link #getValues() <em>Values</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getValue()
+ * @see #getValues()
* @generated
* @ordered
*/
- protected AppearanceStyle value = VALUE_EDEFAULT;
+ protected EList values = null;
/**
* <!-- begin-user-doc -->
@@ -75,20 +65,11 @@ public class GenericStyleSelectorImpl extends EObjectImpl implements GenericStyl
* <!-- end-user-doc -->
* @generated
*/
- public AppearanceStyle getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setValue(AppearanceStyle newValue) {
- AppearanceStyle oldValue = value;
- value = newValue == null ? VALUE_EDEFAULT : newValue;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUE, oldValue, value));
+ public EList getValues() {
+ if (values == null) {
+ values = new EDataTypeUniqueEList(AppearanceStyle.class, this, GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUES);
+ }
+ return values;
}
/**
@@ -100,7 +81,14 @@ public class GenericStyleSelectorImpl extends EObjectImpl implements GenericStyl
if (false == style instanceof EObject) {
return false;
}
- return ((EObject) style).eClass().getName().equals(getValue().getName() + "Style");
+ final String styleName = ((EObject) style).eClass().getName();
+ for (Iterator it = getValues().iterator(); it.hasNext(); ) {
+ AppearanceStyle s = (AppearanceStyle) it.next();
+ if (styleName.equals(s.getName() + "Style")) {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -110,8 +98,8 @@ public class GenericStyleSelectorImpl extends EObjectImpl implements GenericStyl
*/
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
- case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUE:
- return getValue();
+ case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUES:
+ return getValues();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -123,8 +111,9 @@ public class GenericStyleSelectorImpl extends EObjectImpl implements GenericStyl
*/
public void eSet(int featureID, Object newValue) {
switch (featureID) {
- case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUE:
- setValue((AppearanceStyle) newValue);
+ case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUES:
+ getValues().clear();
+ getValues().addAll((Collection) newValue);
return;
}
super.eSet(featureID, newValue);
@@ -137,8 +126,8 @@ public class GenericStyleSelectorImpl extends EObjectImpl implements GenericStyl
*/
public void eUnset(int featureID) {
switch (featureID) {
- case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUE:
- setValue(VALUE_EDEFAULT);
+ case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUES:
+ getValues().clear();
return;
}
super.eUnset(featureID);
@@ -151,8 +140,8 @@ public class GenericStyleSelectorImpl extends EObjectImpl implements GenericStyl
*/
public boolean eIsSet(int featureID) {
switch (featureID) {
- case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUE:
- return value != VALUE_EDEFAULT;
+ case GMFToolPackage.GENERIC_STYLE_SELECTOR__VALUES:
+ return values != null && !values.isEmpty();
}
return super.eIsSet(featureID);
}
@@ -167,8 +156,8 @@ public class GenericStyleSelectorImpl extends EObjectImpl implements GenericStyl
return super.toString();
StringBuffer result = new StringBuffer(super.toString());
- result.append(" (value: ");
- result.append(value);
+ result.append(" (values: ");
+ result.append(values);
result.append(')');
return result.toString();
}
diff --git a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ToolDefHandocodedImplTest.java b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ToolDefHandocodedImplTest.java
index 6d9d2703f..f52bcf03f 100644
--- a/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ToolDefHandocodedImplTest.java
+++ b/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ToolDefHandocodedImplTest.java
@@ -13,6 +13,9 @@ package org.eclipse.gmf.tests.gen;
import junit.framework.TestCase;
+import org.eclipse.gmf.runtime.notation.FillStyle;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.LineStyle;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.tooldef.AppearanceStyle;
import org.eclipse.gmf.tooldef.GMFToolFactory;
@@ -29,11 +32,26 @@ public class ToolDefHandocodedImplTest extends TestCase {
public void testGenericStyleSelector() {
final GenericStyleSelector ss = GMFToolFactory.eINSTANCE.createGenericStyleSelector();
- ss.setValue(AppearanceStyle.FILL_LITERAL);
- assertTrue(ss.isOk(NotationFactory.eINSTANCE.createFillStyle()));
- ss.setValue(AppearanceStyle.LINE_LITERAL);
- assertTrue(ss.isOk(NotationFactory.eINSTANCE.createLineStyle()));
- ss.setValue(AppearanceStyle.FONT_LITERAL);
+ final FillStyle fillStyle = NotationFactory.eINSTANCE.createFillStyle();
+ final LineStyle lineStyle = NotationFactory.eINSTANCE.createLineStyle();
+ final FontStyle fontStyle = NotationFactory.eINSTANCE.createFontStyle();
+
+ ss.getValues().add(AppearanceStyle.FILL_LITERAL);
+ assertTrue(ss.isOk(fillStyle));
+ assertFalse(ss.isOk(fontStyle));
+ ss.getValues().clear();
+ ss.getValues().add(AppearanceStyle.LINE_LITERAL);
+ assertTrue(ss.isOk(lineStyle));
+ ss.getValues().clear();
+ ss.getValues().add(AppearanceStyle.FONT_LITERAL);
+ assertTrue(ss.isOk(fontStyle));
+ assertFalse(ss.isOk(lineStyle));
+ // note, no clear(), two values in the list
+ ss.getValues().add(AppearanceStyle.FILL_LITERAL);
assertTrue(ss.isOk(NotationFactory.eINSTANCE.createFontStyle()));
+ assertFalse(ss.isOk(lineStyle));
+ assertFalse(ss.isOk(NotationFactory.eINSTANCE.createLineStyle()));
+ assertTrue(ss.isOk(NotationFactory.eINSTANCE.createFillStyle()));
+ assertTrue(ss.isOk(fillStyle));
}
}

Back to the top