aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskovalsky2012-03-17 14:37:07 (EDT)
committermgolubev2012-03-18 18:04:37 (EDT)
commit2f858fa16a05729bf6179b8b3cb9b2b28670332b (patch)
tree73322b9a5e42e2cff3ca4ddb96ac3dc1271425f1
parent986124c0d8c069e4828325a1fcebdc4693a18a57 (diff)
downloadorg.eclipse.gmf-tooling-2f858fa16a05729bf6179b8b3cb9b2b28670332b.zip
org.eclipse.gmf-tooling-2f858fa16a05729bf6179b8b3cb9b2b28670332b.tar.gz
org.eclipse.gmf-tooling-2f858fa16a05729bf6179b8b3cb9b2b28670332b.tar.bz2
[158116] - support for PredefinedEnumParser's in the templates
-rw-r--r--plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java134
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/icons/full/obj16/PredefinedEnumParser.gifbin0 -> 129 bytes
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/plugin.properties1
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java24
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenParsersItemProvider.java5
-rw-r--r--plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/PredefinedEnumParserItemProvider.java119
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore3
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.emf4
-rw-r--r--plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel3
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java9
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java85
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/PredefinedEnumParser.java29
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java11
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java25
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/PredefinedEnumParserImpl.java56
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java18
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java22
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java4
-rw-r--r--plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java3
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/EnumUtils.qvto17
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt28
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt48
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/parsers/PredefinedEnumParser.xpt81
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt26
24 files changed, 696 insertions, 59 deletions
diff --git a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java
index 311356a..5c07d0b 100644
--- a/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java
+++ b/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/internal/bridge/genmodel/DiagramGenModelTransformer.java
@@ -25,15 +25,92 @@ import org.eclipse.emf.codegen.ecore.genmodel.GenDataType;
import org.eclipse.emf.codegen.ecore.genmodel.GenFeature;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.gmf.codegen.gmfgen.*;
+import org.eclipse.gmf.codegen.gmfgen.DesignLabelModelFacet;
+import org.eclipse.gmf.codegen.gmfgen.ElementType;
+import org.eclipse.gmf.codegen.gmfgen.ExpressionLabelModelFacet;
+import org.eclipse.gmf.codegen.gmfgen.ExpressionLabelParser;
+import org.eclipse.gmf.codegen.gmfgen.ExternalParser;
+import org.eclipse.gmf.codegen.gmfgen.FeatureLabelModelFacet;
+import org.eclipse.gmf.codegen.gmfgen.FeatureLinkModelFacet;
+import org.eclipse.gmf.codegen.gmfgen.GMFGenFactory;
+import org.eclipse.gmf.codegen.gmfgen.GenActionFactoryContributionItem;
+import org.eclipse.gmf.codegen.gmfgen.GenApplication;
+import org.eclipse.gmf.codegen.gmfgen.GenAuditContainer;
+import org.eclipse.gmf.codegen.gmfgen.GenAuditContext;
+import org.eclipse.gmf.codegen.gmfgen.GenAuditRoot;
+import org.eclipse.gmf.codegen.gmfgen.GenAuditRule;
+import org.eclipse.gmf.codegen.gmfgen.GenAuditable;
+import org.eclipse.gmf.codegen.gmfgen.GenAuditedMetricTarget;
+import org.eclipse.gmf.codegen.gmfgen.GenChildContainer;
+import org.eclipse.gmf.codegen.gmfgen.GenChildLabelNode;
+import org.eclipse.gmf.codegen.gmfgen.GenChildNode;
+import org.eclipse.gmf.codegen.gmfgen.GenChildSideAffixedNode;
+import org.eclipse.gmf.codegen.gmfgen.GenCommonBase;
+import org.eclipse.gmf.codegen.gmfgen.GenCompartment;
+import org.eclipse.gmf.codegen.gmfgen.GenConstraint;
+import org.eclipse.gmf.codegen.gmfgen.GenContextMenu;
+import org.eclipse.gmf.codegen.gmfgen.GenContributionItem;
+import org.eclipse.gmf.codegen.gmfgen.GenDiagram;
+import org.eclipse.gmf.codegen.gmfgen.GenDiagramElementTarget;
+import org.eclipse.gmf.codegen.gmfgen.GenDomainAttributeTarget;
+import org.eclipse.gmf.codegen.gmfgen.GenDomainElementTarget;
+import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator;
+import org.eclipse.gmf.codegen.gmfgen.GenElementInitializer;
+import org.eclipse.gmf.codegen.gmfgen.GenExpressionInterpreter;
+import org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderBase;
+import org.eclipse.gmf.codegen.gmfgen.GenExpressionProviderContainer;
+import org.eclipse.gmf.codegen.gmfgen.GenFeatureInitializer;
+import org.eclipse.gmf.codegen.gmfgen.GenFeatureSeqInitializer;
+import org.eclipse.gmf.codegen.gmfgen.GenFeatureValueSpec;
+import org.eclipse.gmf.codegen.gmfgen.GenGroupMarker;
+import org.eclipse.gmf.codegen.gmfgen.GenLanguage;
+import org.eclipse.gmf.codegen.gmfgen.GenLink;
+import org.eclipse.gmf.codegen.gmfgen.GenLinkConstraints;
+import org.eclipse.gmf.codegen.gmfgen.GenLinkLabel;
+import org.eclipse.gmf.codegen.gmfgen.GenMeasurable;
+import org.eclipse.gmf.codegen.gmfgen.GenMenuManager;
+import org.eclipse.gmf.codegen.gmfgen.GenMetricContainer;
+import org.eclipse.gmf.codegen.gmfgen.GenMetricRule;
+import org.eclipse.gmf.codegen.gmfgen.GenNavigator;
+import org.eclipse.gmf.codegen.gmfgen.GenNode;
+import org.eclipse.gmf.codegen.gmfgen.GenNodeLabel;
+import org.eclipse.gmf.codegen.gmfgen.GenNotationElementTarget;
+import org.eclipse.gmf.codegen.gmfgen.GenParserImplementation;
+import org.eclipse.gmf.codegen.gmfgen.GenParsers;
+import org.eclipse.gmf.codegen.gmfgen.GenPreferencePage;
+import org.eclipse.gmf.codegen.gmfgen.GenPropertySheet;
+import org.eclipse.gmf.codegen.gmfgen.GenReferenceNewElementSpec;
+import org.eclipse.gmf.codegen.gmfgen.GenRuleTarget;
+import org.eclipse.gmf.codegen.gmfgen.GenSeparator;
+import org.eclipse.gmf.codegen.gmfgen.GenSeverity;
+import org.eclipse.gmf.codegen.gmfgen.GenSharedContributionItem;
+import org.eclipse.gmf.codegen.gmfgen.GenStandardPreferencePage;
+import org.eclipse.gmf.codegen.gmfgen.GenToolBarManager;
+import org.eclipse.gmf.codegen.gmfgen.GenTopLevelNode;
+import org.eclipse.gmf.codegen.gmfgen.LabelModelFacet;
+import org.eclipse.gmf.codegen.gmfgen.LabelOffsetAttributes;
import org.eclipse.gmf.codegen.gmfgen.LabelTextAccessMethod;
+import org.eclipse.gmf.codegen.gmfgen.LinkLabelAlignment;
+import org.eclipse.gmf.codegen.gmfgen.LinkModelFacet;
+import org.eclipse.gmf.codegen.gmfgen.MetamodelType;
+import org.eclipse.gmf.codegen.gmfgen.OpenDiagramBehaviour;
+import org.eclipse.gmf.codegen.gmfgen.Palette;
+import org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser;
+import org.eclipse.gmf.codegen.gmfgen.PredefinedParser;
+import org.eclipse.gmf.codegen.gmfgen.ProviderPriority;
+import org.eclipse.gmf.codegen.gmfgen.SpecializationType;
+import org.eclipse.gmf.codegen.gmfgen.StandardPreferencePages;
+import org.eclipse.gmf.codegen.gmfgen.TypeLinkModelFacet;
+import org.eclipse.gmf.codegen.gmfgen.TypeModelFacet;
import org.eclipse.gmf.codegen.gmfgen.ValueExpression;
import org.eclipse.gmf.gmfgraph.Alignment;
import org.eclipse.gmf.gmfgraph.AlignmentFacet;
@@ -50,8 +127,38 @@ import org.eclipse.gmf.internal.bridge.VisualIdentifierDispenser;
import org.eclipse.gmf.internal.bridge.genmodel.navigator.NavigatorHandler;
import org.eclipse.gmf.internal.bridge.tooldef.PaletteHandler;
import org.eclipse.gmf.internal.codegen.util.Extras;
-import org.eclipse.gmf.mappings.*;
+import org.eclipse.gmf.mappings.AuditContainer;
+import org.eclipse.gmf.mappings.AuditRule;
+import org.eclipse.gmf.mappings.AuditedMetricTarget;
+import org.eclipse.gmf.mappings.CanvasMapping;
+import org.eclipse.gmf.mappings.ChildReference;
+import org.eclipse.gmf.mappings.CompartmentMapping;
+import org.eclipse.gmf.mappings.Constraint;
+import org.eclipse.gmf.mappings.DesignLabelMapping;
+import org.eclipse.gmf.mappings.DiagramElementTarget;
+import org.eclipse.gmf.mappings.DomainAttributeTarget;
+import org.eclipse.gmf.mappings.DomainElementTarget;
+import org.eclipse.gmf.mappings.ElementInitializer;
+import org.eclipse.gmf.mappings.ExpressionLabelMapping;
+import org.eclipse.gmf.mappings.FeatureInitializer;
+import org.eclipse.gmf.mappings.FeatureLabelMapping;
+import org.eclipse.gmf.mappings.FeatureSeqInitializer;
+import org.eclipse.gmf.mappings.FeatureValueSpec;
+import org.eclipse.gmf.mappings.GMFMapPackage;
+import org.eclipse.gmf.mappings.LabelMapping;
+import org.eclipse.gmf.mappings.Language;
import org.eclipse.gmf.mappings.LinkConstraints;
+import org.eclipse.gmf.mappings.LinkMapping;
+import org.eclipse.gmf.mappings.Mapping;
+import org.eclipse.gmf.mappings.MappingEntry;
+import org.eclipse.gmf.mappings.MetricContainer;
+import org.eclipse.gmf.mappings.MetricRule;
+import org.eclipse.gmf.mappings.NodeMapping;
+import org.eclipse.gmf.mappings.NodeReference;
+import org.eclipse.gmf.mappings.NotationElementTarget;
+import org.eclipse.gmf.mappings.ReferenceNewElementSpec;
+import org.eclipse.gmf.mappings.Severity;
+import org.eclipse.gmf.mappings.TopNodeReference;
/**
* Creates generation model from diagram definition.
@@ -1310,6 +1417,29 @@ public class DiagramGenModelTransformer extends MappingTransformer {
}
private GenParserImplementation getOrCreateParser(FeatureLabelMapping flMapping) {
+ EList<EAttribute> features = flMapping.getFeatures();
+ EList<EAttribute> editFeatures = flMapping.getEditableFeatures();
+ if (features.size() == 1 && editFeatures.size() == 1 //
+ && features.get(0) == editFeatures.get(0) //
+ && features.get(0).getEType() instanceof EEnum) {
+ return getOrCreateEnumParser(flMapping);
+ } else {
+ return getOrCreatePredefinedParser(flMapping);
+ }
+ }
+
+ private GenParserImplementation getOrCreateEnumParser(FeatureLabelMapping flMapping) {
+ for (GenParserImplementation pi : getGenParsers().getImplementations()) {
+ if (pi instanceof PredefinedEnumParser) {
+ return (PredefinedEnumParser) pi;
+ }
+ }
+ PredefinedEnumParser result = GMFGenFactory.eINSTANCE.createPredefinedEnumParser();
+ getGenParsers().getImplementations().add(result);
+ return result;
+ }
+
+ private GenParserImplementation getOrCreatePredefinedParser(FeatureLabelMapping flMapping) {
final LabelTextAccessMethod editMethod = LabelTextAccessMethod.get(flMapping.getEditMethod().getValue());
final LabelTextAccessMethod viewMethod = LabelTextAccessMethod.get(flMapping.getViewMethod().getValue());
for (GenParserImplementation pi : getGenParsers().getImplementations()) {
diff --git a/plugins/org.eclipse.gmf.codegen.edit/icons/full/obj16/PredefinedEnumParser.gif b/plugins/org.eclipse.gmf.codegen.edit/icons/full/obj16/PredefinedEnumParser.gif
new file mode 100644
index 0000000..05dc74a
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen.edit/icons/full/obj16/PredefinedEnumParser.gif
Binary files differ
diff --git a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
index df59b94..5c64a2b 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
+++ b/plugins/org.eclipse.gmf.codegen.edit/plugin.properties
@@ -929,3 +929,4 @@ _UI_ExpressionLabelParser_expressionContext_feature = Expression Context
_UI_ExpressionLabelParser_viewExpression_feature = View Expression
_UI_ExpressionLabelParser_editExpression_feature = Edit Expression
_UI_ExpressionLabelParser_validateExpression_feature = Validate Expression
+_UI_PredefinedEnumParser_type = Predefined Enum Parser
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java
index 11aab27..1961960 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java
@@ -2251,6 +2251,29 @@ public class GMFGenItemProviderAdapterFactory extends GMFGenAdapterFactory imple
}
/**
+ * This keeps track of the one adapter used for all {@link org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PredefinedEnumParserItemProvider predefinedEnumParserItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createPredefinedEnumParserAdapter() {
+ if (predefinedEnumParserItemProvider == null) {
+ predefinedEnumParserItemProvider = new PredefinedEnumParserItemProvider(this);
+ }
+
+ return predefinedEnumParserItemProvider;
+ }
+
+ /**
* This keeps track of the one adapter used for all {@link org.eclipse.gmf.codegen.gmfgen.ExpressionLabelParser} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2587,6 +2610,7 @@ public class GMFGenItemProviderAdapterFactory extends GMFGenAdapterFactory imple
if (genApplicationItemProvider != null) genApplicationItemProvider.dispose();
if (genParsersItemProvider != null) genParsersItemProvider.dispose();
if (predefinedParserItemProvider != null) predefinedParserItemProvider.dispose();
+ if (predefinedEnumParserItemProvider != null) predefinedEnumParserItemProvider.dispose();
if (expressionLabelParserItemProvider != null) expressionLabelParserItemProvider.dispose();
if (customParserItemProvider != null) customParserItemProvider.dispose();
if (externalParserItemProvider != null) externalParserItemProvider.dispose();
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenParsersItemProvider.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenParsersItemProvider.java
index 645376b..10cf678 100644
--- a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenParsersItemProvider.java
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GenParsersItemProvider.java
@@ -297,6 +297,11 @@ public class GenParsersItemProvider
newChildDescriptors.add
(createChildParameter
(GMFGenPackage.eINSTANCE.getGenParsers_Implementations(),
+ GMFGenFactory.eINSTANCE.createPredefinedEnumParser()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (GMFGenPackage.eINSTANCE.getGenParsers_Implementations(),
GMFGenFactory.eINSTANCE.createExpressionLabelParser()));
newChildDescriptors.add
diff --git a/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/PredefinedEnumParserItemProvider.java b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/PredefinedEnumParserItemProvider.java
new file mode 100644
index 0000000..4880b4d
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/PredefinedEnumParserItemProvider.java
@@ -0,0 +1,119 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.gmf.codegen.gmfgen.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class PredefinedEnumParserItemProvider
+ extends GenParserImplementationItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PredefinedEnumParserItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This returns PredefinedEnumParser.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/PredefinedEnumParser"));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected boolean shouldComposeCreationImage() {
+ return true;
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_PredefinedEnumParser_type");
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
index fa82966..e44f612 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore
@@ -2298,6 +2298,9 @@
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="PredefinedEnumParser" eSuperTypes="#//GenParserImplementation">
+ <eOperations name="getQualifiedClassName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExpressionLabelParser" eSuperTypes="#//GenParserImplementation">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Parser implementation that uses expressions to produce string values"/>
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.emf b/plugins/org.eclipse.gmf.codegen/models/gmfgen.emf
index 24733ce..3da1bcb 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.emf
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.emf
@@ -1596,6 +1596,10 @@ class PredefinedParser extends GenParserImplementation {
op String getQualifiedClassName();
}
+class PredefinedEnumParser extends GenParserImplementation {
+ op String getQualifiedClassName();
+}
+
@genmodel(documentation="Parser implementation that uses expressions to produce string values")
class ExpressionLabelParser extends GenParserImplementation {
@genmodel(documentation="Provides means to alter name of parser implementation class")
diff --git a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
index 720f453..0769bc4 100644
--- a/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
+++ b/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel
@@ -1033,6 +1033,9 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//PredefinedParser/className"/>
<genOperations ecoreOperation="gmfgen.ecore#//PredefinedParser/getQualifiedClassName"/>
</genClasses>
+ <genClasses ecoreClass="gmfgen.ecore#//PredefinedEnumParser">
+ <genOperations ecoreOperation="gmfgen.ecore#//PredefinedEnumParser/getQualifiedClassName"/>
+ </genClasses>
<genClasses ecoreClass="gmfgen.ecore#//ExpressionLabelParser">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//ExpressionLabelParser/className"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference gmfgen.ecore#//ExpressionLabelParser/expressionContext"/>
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java
index 66bc942..14cfce3 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java
@@ -872,6 +872,15 @@ public interface GMFGenFactory extends EFactory {
PredefinedParser createPredefinedParser();
/**
+ * Returns a new object of class '<em>Predefined Enum Parser</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Predefined Enum Parser</em>'.
+ * @generated
+ */
+ PredefinedEnumParser createPredefinedEnumParser();
+
+ /**
* Returns a new object of class '<em>Expression Label Parser</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java
index e3ac1c6..44eb890 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java
@@ -10756,6 +10756,43 @@ public interface GMFGenPackage extends EPackage {
int PREDEFINED_PARSER_FEATURE_COUNT = GEN_PARSER_IMPLEMENTATION_FEATURE_COUNT + 3;
/**
+ * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.PredefinedEnumParserImpl <em>Predefined Enum Parser</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.gmf.codegen.gmfgen.impl.PredefinedEnumParserImpl
+ * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getPredefinedEnumParser()
+ * @generated
+ */
+ int PREDEFINED_ENUM_PARSER = 136;
+
+ /**
+ * The feature id for the '<em><b>Holder</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PREDEFINED_ENUM_PARSER__HOLDER = GEN_PARSER_IMPLEMENTATION__HOLDER;
+
+ /**
+ * The feature id for the '<em><b>Uses</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PREDEFINED_ENUM_PARSER__USES = GEN_PARSER_IMPLEMENTATION__USES;
+
+ /**
+ * The number of structural features of the '<em>Predefined Enum Parser</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PREDEFINED_ENUM_PARSER_FEATURE_COUNT = GEN_PARSER_IMPLEMENTATION_FEATURE_COUNT + 0;
+
+ /**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.ExpressionLabelParserImpl <em>Expression Label Parser</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -10763,7 +10800,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getExpressionLabelParser()
* @generated
*/
- int EXPRESSION_LABEL_PARSER = 136;
+ int EXPRESSION_LABEL_PARSER = 137;
/**
* The feature id for the '<em><b>Holder</b></em>' container reference.
@@ -10845,7 +10882,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getCustomParser()
* @generated
*/
- int CUSTOM_PARSER = 137;
+ int CUSTOM_PARSER = 138;
/**
* The feature id for the '<em><b>Holder</b></em>' container reference.
@@ -10900,7 +10937,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getExternalParser()
* @generated
*/
- int EXTERNAL_PARSER = 138;
+ int EXTERNAL_PARSER = 139;
/**
* The feature id for the '<em><b>Holder</b></em>' container reference.
@@ -10946,7 +10983,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getStandardPreferencePages()
* @generated
*/
- int STANDARD_PREFERENCE_PAGES = 139;
+ int STANDARD_PREFERENCE_PAGES = 140;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.RulerUnits <em>Ruler Units</em>}' enum.
@@ -10956,7 +10993,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getRulerUnits()
* @generated
*/
- int RULER_UNITS = 140;
+ int RULER_UNITS = 141;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.Routing <em>Routing</em>}' enum.
@@ -10966,7 +11003,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getRouting()
* @generated
*/
- int ROUTING = 141;
+ int ROUTING = 142;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.LineStyle <em>Line Style</em>}' enum.
@@ -10976,7 +11013,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getLineStyle()
* @generated
*/
- int LINE_STYLE = 142;
+ int LINE_STYLE = 143;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.JFaceFont <em>JFace Font</em>}' enum.
@@ -10986,7 +11023,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getJFaceFont()
* @generated
*/
- int JFACE_FONT = 143;
+ int JFACE_FONT = 144;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.FontStyle <em>Font Style</em>}' enum.
@@ -10996,7 +11033,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getFontStyle()
* @generated
*/
- int FONT_STYLE = 144;
+ int FONT_STYLE = 145;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.DiagramColors <em>Diagram Colors</em>}' enum.
@@ -11006,7 +11043,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getDiagramColors()
* @generated
*/
- int DIAGRAM_COLORS = 145;
+ int DIAGRAM_COLORS = 146;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.ProviderPriority <em>Provider Priority</em>}' enum.
@@ -11016,7 +11053,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getProviderPriority()
* @generated
*/
- int PROVIDER_PRIORITY = 146;
+ int PROVIDER_PRIORITY = 147;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.LinkLabelAlignment <em>Link Label Alignment</em>}' enum.
@@ -11026,7 +11063,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getLinkLabelAlignment()
* @generated
*/
- int LINK_LABEL_ALIGNMENT = 147;
+ int LINK_LABEL_ALIGNMENT = 148;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.LabelTextAccessMethod <em>Label Text Access Method</em>}' enum.
@@ -11036,7 +11073,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getLabelTextAccessMethod()
* @generated
*/
- int LABEL_TEXT_ACCESS_METHOD = 148;
+ int LABEL_TEXT_ACCESS_METHOD = 149;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.ViewmapLayoutType <em>Viewmap Layout Type</em>}' enum.
@@ -11046,7 +11083,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getViewmapLayoutType()
* @generated
*/
- int VIEWMAP_LAYOUT_TYPE = 149;
+ int VIEWMAP_LAYOUT_TYPE = 150;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.StandardEntryKind <em>Standard Entry Kind</em>}' enum.
@@ -11056,7 +11093,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getStandardEntryKind()
* @generated
*/
- int STANDARD_ENTRY_KIND = 150;
+ int STANDARD_ENTRY_KIND = 151;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.GenSeverity <em>Gen Severity</em>}' enum.
@@ -11066,7 +11103,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenSeverity()
* @generated
*/
- int GEN_SEVERITY = 151;
+ int GEN_SEVERITY = 152;
/**
* The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.GenLanguage <em>Gen Language</em>}' enum.
@@ -11076,7 +11113,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenLanguage()
* @generated
*/
- int GEN_LANGUAGE = 152;
+ int GEN_LANGUAGE = 153;
/**
@@ -11087,7 +11124,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenNavigatorReferenceType()
* @generated
*/
- int GEN_NAVIGATOR_REFERENCE_TYPE = 153;
+ int GEN_NAVIGATOR_REFERENCE_TYPE = 154;
/**
@@ -11098,7 +11135,7 @@ public interface GMFGenPackage extends EPackage {
* @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGeneratedType()
* @generated
*/
- int GENERATED_TYPE = 154;
+ int GENERATED_TYPE = 155;
/**
@@ -17544,6 +17581,16 @@ public interface GMFGenPackage extends EPackage {
EAttribute getPredefinedParser_ClassName();
/**
+ * Returns the meta object for class '{@link org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser <em>Predefined Enum Parser</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Predefined Enum Parser</em>'.
+ * @see org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser
+ * @generated
+ */
+ EClass getPredefinedEnumParser();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.gmf.codegen.gmfgen.ExpressionLabelParser <em>Expression Label Parser</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/PredefinedEnumParser.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/PredefinedEnumParser.java
new file mode 100644
index 0000000..1859dbb
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/PredefinedEnumParser.java
@@ -0,0 +1,29 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.gmf.codegen.gmfgen;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Predefined Enum Parser</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getPredefinedEnumParser()
+ * @model
+ * @generated
+ */
+public interface PredefinedEnumParser extends GenParserImplementation {
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @model kind="operation"
+ * @generated
+ */
+ String getQualifiedClassName();
+} // PredefinedEnumParser
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java
index 40935e0..fd2f1f8 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java
@@ -156,6 +156,7 @@ public class GMFGenFactoryImpl extends EFactoryImpl implements GMFGenFactory {
case GMFGenPackage.GEN_APPLICATION: return createGenApplication();
case GMFGenPackage.GEN_PARSERS: return createGenParsers();
case GMFGenPackage.PREDEFINED_PARSER: return createPredefinedParser();
+ case GMFGenPackage.PREDEFINED_ENUM_PARSER: return createPredefinedEnumParser();
case GMFGenPackage.EXPRESSION_LABEL_PARSER: return createExpressionLabelParser();
case GMFGenPackage.CUSTOM_PARSER: return createCustomParser();
case GMFGenPackage.EXTERNAL_PARSER: return createExternalParser();
@@ -1219,6 +1220,16 @@ public class GMFGenFactoryImpl extends EFactoryImpl implements GMFGenFactory {
* <!-- end-user-doc -->
* @generated
*/
+ public PredefinedEnumParser createPredefinedEnumParser() {
+ PredefinedEnumParserImpl predefinedEnumParser = new PredefinedEnumParserImpl();
+ return predefinedEnumParser;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public ExpressionLabelParser createExpressionLabelParser() {
ExpressionLabelParserImpl expressionLabelParser = new ExpressionLabelParserImpl();
return expressionLabelParser;
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
index dd4f873..7f3089f 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java
@@ -1003,6 +1003,13 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
* <!-- end-user-doc -->
* @generated
*/
+ private EClass predefinedEnumParserEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
private EClass expressionLabelParserEClass = null;
/**
@@ -7036,9 +7043,21 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
* <!-- end-user-doc -->
* @generated
*/
+ public EClass getPredefinedEnumParser() {
+ if (predefinedEnumParserEClass == null) {
+ predefinedEnumParserEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(GMFGenPackage.eNS_URI).getEClassifiers().get(152);
+ }
+ return predefinedEnumParserEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EClass getExpressionLabelParser() {
if (expressionLabelParserEClass == null) {
- expressionLabelParserEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(GMFGenPackage.eNS_URI).getEClassifiers().get(152);
+ expressionLabelParserEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(GMFGenPackage.eNS_URI).getEClassifiers().get(153);
}
return expressionLabelParserEClass;
}
@@ -7095,7 +7114,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
*/
public EClass getCustomParser() {
if (customParserEClass == null) {
- customParserEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(GMFGenPackage.eNS_URI).getEClassifiers().get(153);
+ customParserEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(GMFGenPackage.eNS_URI).getEClassifiers().get(154);
}
return customParserEClass;
}
@@ -7125,7 +7144,7 @@ public class GMFGenPackageImpl extends EPackageImpl implements GMFGenPackage {
*/
public EClass getExternalParser() {
if (externalParserEClass == null) {
- externalParserEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(GMFGenPackage.eNS_URI).getEClassifiers().get(154);
+ externalParserEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(GMFGenPackage.eNS_URI).getEClassifiers().get(155);
}
return externalParserEClass;
}
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/PredefinedEnumParserImpl.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/PredefinedEnumParserImpl.java
new file mode 100644
index 0000000..ba8036d
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/PredefinedEnumParserImpl.java
@@ -0,0 +1,56 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.gmf.codegen.gmfgen.impl;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage;
+import org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Predefined Enum Parser</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * </p>
+ *
+ * @generated
+ */
+public class PredefinedEnumParserImpl extends GenParserImplementationImpl implements PredefinedEnumParser {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PredefinedEnumParserImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return GMFGenPackage.eINSTANCE.getPredefinedEnumParser();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public String getQualifiedClassName() {
+ String n = "EnumParser";
+ if (getHolder() == null || GenCommonBaseImpl.isEmpty(getHolder().getImplPackageName())) {
+ return n;
+ }
+ return getHolder().getImplPackageName() + '.' + n;
+ }
+
+} //PredefinedEnumParserImpl
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java
index cd9b062..1d51c45 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java
@@ -613,6 +613,10 @@ public class GMFGenAdapterFactory extends AdapterFactoryImpl {
return createPredefinedParserAdapter();
}
@Override
+ public Adapter casePredefinedEnumParser(PredefinedEnumParser object) {
+ return createPredefinedEnumParserAdapter();
+ }
+ @Override
public Adapter caseExpressionLabelParser(ExpressionLabelParser object) {
return createExpressionLabelParserAdapter();
}
@@ -2507,6 +2511,20 @@ public class GMFGenAdapterFactory extends AdapterFactoryImpl {
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser <em>Predefined Enum Parser</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.gmf.codegen.gmfgen.PredefinedEnumParser
+ * @generated
+ */
+ public Adapter createPredefinedEnumParserAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link org.eclipse.gmf.codegen.gmfgen.ExpressionLabelParser <em>Expression Label Parser</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java
index d846d51..b7b1011 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java
@@ -1035,6 +1035,13 @@ public class GMFGenSwitch<T> extends Switch<T> {
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case GMFGenPackage.PREDEFINED_ENUM_PARSER: {
+ PredefinedEnumParser predefinedEnumParser = (PredefinedEnumParser)theEObject;
+ T result = casePredefinedEnumParser(predefinedEnumParser);
+ if (result == null) result = caseGenParserImplementation(predefinedEnumParser);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
case GMFGenPackage.EXPRESSION_LABEL_PARSER: {
ExpressionLabelParser expressionLabelParser = (ExpressionLabelParser)theEObject;
T result = caseExpressionLabelParser(expressionLabelParser);
@@ -3056,6 +3063,21 @@ public class GMFGenSwitch<T> extends Switch<T> {
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Predefined Enum Parser</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Predefined Enum Parser</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePredefinedEnumParser(PredefinedEnumParser object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>Expression Label Parser</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java
index 9346b98..3e568a2 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/CodegenEmitters.java
@@ -260,6 +260,10 @@ public class CodegenEmitters {
public TextEmitter getPredefinedParserEmitter() throws UnexpectedBehaviourException {
return newXpandEmitter("parsers::PredefinedParser::Main"); //$NON-NLS-1$
}
+
+ public TextEmitter getPredefinedEnumParserEmitter() throws UnexpectedBehaviourException {
+ return newXpandEmitter("parsers::PredefinedEnumParser::Main"); //$NON-NLS-1$
+ }
public TextEmitter getCustomParserEmitter() throws UnexpectedBehaviourException {
return newXpandEmitter("parsers::CustomParser::Main"); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java
index cd5159d..b28cfc7 100644
--- a/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java
+++ b/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/util/Generator.java
@@ -506,6 +506,9 @@ public class Generator extends GeneratorBase implements Runnable {
if (pi instanceof PredefinedParser) {
needsAbstractParser = true;
doGenerateJavaClass(myEmitters.getPredefinedParserEmitter(), ((PredefinedParser) pi).getQualifiedClassName(), pi);
+ } else if (pi instanceof PredefinedEnumParser) {
+ needsAbstractParser = true;
+ doGenerateJavaClass(myEmitters.getPredefinedEnumParserEmitter(), ((PredefinedEnumParser) pi).getQualifiedClassName(), pi);
} else if (pi instanceof CustomParser && ((CustomParser) pi).isGenerateBoilerplate()) {
doGenerateJavaClass(myEmitters.getCustomParserEmitter(), ((CustomParser) pi).getQualifiedName(), pi);
} else if (pi instanceof ExpressionLabelParser) {
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/EnumUtils.qvto b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/EnumUtils.qvto
new file mode 100644
index 0000000..25e00b4
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/EnumUtils.qvto
@@ -0,0 +1,17 @@
+modeltype gmfgen uses "http://www.eclipse.org/gmf/2009/GenModel";
+modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
+
+library Utils;
+
+helper isEnumLabel(modelFacet : gmfgen::LabelModelFacet) : Boolean {
+ return modelFacet.parser.oclIsKindOf(gmfgen::PredefinedEnumParser);
+}
+
+helper getDirectManagerFQN(modelFacet : gmfgen::LabelModelFacet) : String {
+ return
+ (if isEnumLabel(modelFacet) then
+ 'org.eclipse.gmf.runtime.diagram.ui.tools.ComboDirectEditManager'
+ else
+ 'org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager'
+ endif);
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt
index e40da64..0b9a0ae 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/diagram/editparts/TextAware.xpt
@@ -13,6 +13,7 @@
«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+«EXTENSION impl::diagram::editparts::EnumUtils»
«DEFINE fields FOR gmfgen::GenCommonBase-»
«EXPAND xpt::Common::generatedMemberComment»
@@ -64,17 +65,19 @@
«EXPAND getParser(modelFacet, diagram, host)-»
- «EXPAND getManager(diagram)-»
+ «EXPAND getManager(diagram, modelFacet)-»
«EXPAND setManager-»
«EXPAND performDirectEdit-»
- «EXPAND performDirectEditAtPoint-»
-
+ «EXPAND performDirectEditAtPoint(modelFacet)-»
+
+«IF not(isEnumLabel(modelFacet))-»
«EXPAND performDirectEditWithInitialChar-»
+«ENDIF»
- «EXPAND performDirectEditRequest-»
+ «EXPAND performDirectEditRequest(modelFacet)-»
«EXPAND refreshVisuals(needsRefreshBounds)-»
@@ -331,12 +334,12 @@
}
«ENDDEFINE»
-«DEFINE getManager(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
+«DEFINE getManager(diagram : gmfgen::GenDiagram, modelFacet : gmfgen::LabelModelFacet) FOR gmfgen::GenCommonBase-»
«EXPAND xpt::Common::generatedMemberComment»
protected org.eclipse.gef.tools.DirectEditManager getManager() {
if (manager == null) {
- setManager(new org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager(this,
- org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.getTextCellEditorClass(this),
+ setManager(new «getDirectManagerFQN(modelFacet)»(this,
+ null,
«diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
}
return manager;
@@ -357,11 +360,11 @@
}
«ENDDEFINE»
-«DEFINE performDirectEditAtPoint FOR gmfgen::GenCommonBase-»
+«DEFINE performDirectEditAtPoint(modelFacet : gmfgen::LabelModelFacet) FOR gmfgen::GenCommonBase-»
«EXPAND xpt::Common::generatedMemberComment»
protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) {
- if (getManager().getClass() == org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.class) {
- ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ if (getManager().getClass() == «getDirectManagerFQN(modelFacet)».class) {
+ ((«getDirectManagerFQN(modelFacet)») getManager()).show(eventLocation.getSWTPoint());
}
}
«ENDDEFINE»
@@ -377,7 +380,7 @@
}
«ENDDEFINE»
-«DEFINE performDirectEditRequest FOR gmfgen::GenCommonBase-»
+«DEFINE performDirectEditRequest(modelFacet : gmfgen::LabelModelFacet) FOR gmfgen::GenCommonBase-»
«EXPAND xpt::Common::generatedMemberComment»
protected void performDirectEditRequest(org.eclipse.gef.Request request) {
final org.eclipse.gef.Request theRequest = request;
@@ -386,10 +389,11 @@
public void run() {
if (isActive() && isEditable()) {
+ «IF not(isEnumLabel(modelFacet))-»
if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
Character initialChar = (Character) theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
performDirectEdit(initialChar.charValue());
- } else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ } else «ENDIF» if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest;
performDirectEdit(editRequest.getLocation());
} else {
diff --git a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt b/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt
index 06f445d..56aacf6 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/impl/parsers/ParserProvider.xpt
@@ -14,7 +14,6 @@
*/
«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
-
«EXTENSION xpt::providers::ParserUtils»
«DEFINE accessorMethod_delegate2providers FOR gmfgen::GenParsers-»
@@ -144,17 +143,24 @@ org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().ge
«DEFINE _getParser(modelFacet : gmfgen::LabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::ExternalParser»«REM»NOTHING TO DO«ENDREM»«ENDDEFINE»
«DEFINE _getParser(modelFacet : gmfgen::LabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::PredefinedParser-»
- «EXPAND xpt::Common::caseVisualID FOR element» return «parserAccessorName(element)»();
+ «EXPAND _doGetParser(element)-»
+«ENDDEFINE»
+
+«DEFINE _getParser(modelFacet : gmfgen::LabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::PredefinedEnumParser»
+ «EXPAND _doGetParser(element)-»
«ENDDEFINE»
«DEFINE _getParser(modelFacet : gmfgen::LabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::CustomParser-»
- «EXPAND xpt::Common::caseVisualID FOR element» return «parserAccessorName(element)»();
+ «EXPAND _doGetParser(element)-»
«ENDDEFINE»
«DEFINE _getParser(modelFacet : gmfgen::LabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::ExpressionLabelParser-»
- «EXPAND xpt::Common::caseVisualID FOR element» return «parserAccessorName(element)»();
+ «EXPAND _doGetParser(element)-»
«ENDDEFINE»
+«DEFINE _doGetParser(element : gmfgen::GenCommonBase) FOR gmfgen::GenParserImplementation-»
+ «EXPAND xpt::Common::caseVisualID FOR element» return «parserAccessorName(element)»();
+«ENDDEFINE»
«DEFINE parsers FOR gmfgen::GenNode»«EXPAND _parser FOREACH labels»«ENDDEFINE»
«DEFINE parsers FOR gmfgen::GenLink»«EXPAND _parser FOREACH labels»«ENDDEFINE»
@@ -183,12 +189,32 @@ org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().ge
«ENDDEFINE»
«DEFINE _parser(modelFacet : gmfgen::FeatureLabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::PredefinedParser»
+ «EXPAND _predefinedParser(modelFacet, element)»
+«ENDDEFINE»
+
+«DEFINE _parser(modelFacet : gmfgen::FeatureLabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::PredefinedEnumParser»
+ «EXPAND _predefinedParser(modelFacet, element)»
+«ENDDEFINE»
+
+«DEFINE _predefinedParser(modelFacet : gmfgen::FeatureLabelModelFacet, element : gmfgen::GenCommonBase) FOR gmfgen::GenParserImplementation»
«EXPAND xpt::Common::generatedMemberComment»
private org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserFieldName(element)»;
«EXPAND xpt::Common::generatedMemberComment»
«IF holder.extensibleViaService»private«ELSE»public«ENDIF» org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserAccessorName(element)»() {
if («parserFieldName(element)» == null) {
+ «EXPAND _createPredefinedParser(modelFacet, 'parser')»
+ «parserFieldName(element)» = parser;
+ }
+ return «parserFieldName(element)»;
+ }
+«ENDDEFINE»
+
+«DEFINE _createPredefinedParser(modelFacet : gmfgen::FeatureLabelModelFacet, parserVar : String) FOR gmfgen::GenParserImplementation»
+ «ERROR 'PredefinedParser or PredefinedEnumParser expected but occured: ' + self.repr()»
+«ENDDEFINE»
+
+«DEFINE _createPredefinedParser(modelFacet : gmfgen::FeatureLabelModelFacet, parserVar : String) FOR gmfgen::PredefinedParser»
org.eclipse.emf.ecore.EAttribute[] features = new org.eclipse.emf.ecore.EAttribute[] {
«EXPAND MetaModel::MetaFeature FOREACH modelFacet.metaFeatures SEPARATOR ', ' »
};
@@ -197,14 +223,16 @@ org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().ge
«EXPAND MetaModel::MetaFeature FOREACH modelFacet.editableMetaFeatures SEPARATOR ', '»
};
«ENDIF-»
- «getQualifiedClassName()» parser = new «getQualifiedClassName()»(features«IF modelFacet.editableMetaFeatures->size() > 0», editableFeatures«ENDIF»);
- «EXPAND _setPatterns(viewMethod, editMethod, 'parser') FOR modelFacet-»
- «parserFieldName(element)» = parser;
- }
- return «parserFieldName(element)»;
- }
+ «getQualifiedClassName()» «parserVar» = new «getQualifiedClassName()»(features«IF modelFacet.editableMetaFeatures->size() > 0», editableFeatures«ENDIF»);
+ «EXPAND _setPatterns(viewMethod, editMethod, parserVar) FOR modelFacet-»
«ENDDEFINE»
+«DEFINE _createPredefinedParser(modelFacet : gmfgen::FeatureLabelModelFacet, parserVar : String) FOR gmfgen::PredefinedEnumParser»
+ org.eclipse.emf.ecore.EAttribute editableFeature = «EXPAND MetaModel::MetaFeature FOR modelFacet.editableMetaFeatures->first()»;
+ «getQualifiedClassName()» «parserVar» = new «getQualifiedClassName()»(editableFeature);
+«ENDDEFINE»
+
+
«DEFINE _setPatterns(viewMethod : gmfgen::LabelTextAccessMethod, editMethod : gmfgen::LabelTextAccessMethod, parserVar : String) FOR gmfgen::FeatureLabelModelFacet-»
«IF viewMethod <> gmfgen::LabelTextAccessMethod::NATIVE-»
«IF isPatternSpecified(viewPattern)-»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/parsers/PredefinedEnumParser.xpt b/plugins/org.eclipse.gmf.codegen/templates/parsers/PredefinedEnumParser.xpt
new file mode 100644
index 0000000..9afe7c0
--- /dev/null
+++ b/plugins/org.eclipse.gmf.codegen/templates/parsers/PredefinedEnumParser.xpt
@@ -0,0 +1,81 @@
+«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
+
+«DEFINE Main FOR gmfgen::PredefinedEnumParser»
+«EXPAND xpt::Common::copyright FOR holder.editorGen-»
+package «holder.implPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class EnumParser extends «EXPAND impl::parsers::AbstractParser::qualifiedClassName FOR holder» implements org.eclipse.gmf.runtime.diagram.ui.tools.ComboDirectEditManager.IChoiceParser {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static final int SINGLE_FEATURE_INDEX = 0;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public EnumParser(org.eclipse.emf.ecore.EAttribute enumFeature) {
+ super(new org.eclipse.emf.ecore.EAttribute[] { enumFeature });
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ @Override
+ public String getEditString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ return getEditChoice(getEditableValues(element)[SINGLE_FEATURE_INDEX].toString());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ @Override
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus isValidEditString(org.eclipse.core.runtime.IAdaptable element, String editString) {
+ return getEditChoices().contains(editString) //
+ ? org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE_STATUS //
+ : new org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus(org.eclipse.gmf.tests.ocl.model.oclTest.diagram.part.OclTestDiagramEditorPlugin.ID, org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.UNEDITABLE, editString);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ @Override
+ public org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(org.eclipse.core.runtime.IAdaptable adapter, String newString, int flags) {
+ return getParseCommand(adapter, new Object[] { findChoiceValue(newString) }, flags);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ @Override
+ public String getPrintString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ return getEditString(adapter, flags);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ @Override
+ public java.util.List<String> getEditChoices() {
+ java.util.List<String> result = new java.util.ArrayList<String>();
+ for (String literal : getLiterals()) {
+ result.add(getEditChoice(literal));
+ }
+ return result;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.util.List<String> getLiterals() {
+ java.util.List<String> result = new java.util.ArrayList<String>();
+ org.eclipse.emf.ecore.EAttribute enumFeature = editableFeatures[SINGLE_FEATURE_INDEX];
+ org.eclipse.emf.ecore.EEnum type = (org.eclipse.emf.ecore.EEnum) enumFeature.getEType();
+ for (org.eclipse.emf.ecore.EEnumLiteral literal : type.getELiterals()) {
+ result.add(literal.getLiteral());
+ }
+ return result;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String findChoiceValue(String editChoice) {
+ for (String literal : getLiterals()) {
+ if (editChoice.equals(getEditChoice(literal))) {
+ return literal;
+ }
+ }
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getEditChoice(String literal) {
+ return literal;
+ }
+}
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt
index 5730cad..6b63143 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt
@@ -73,19 +73,19 @@ public class «editPartFactoryClassName» implements org.eclipse.gef.EditPartFac
«EXPAND xpt::Common::generatedMemberComment»
public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
- org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl();
+ org.eclipse.swt.widgets.Control control = (org.eclipse.swt.widgets.Control) celleditor.getControl();
org.eclipse.draw2d.geometry.Rectangle rect = getWrapLabel().getTextBounds().getCopy();
getWrapLabel().translateToAbsolute(rect);
- if (!text.getFont().isDisposed()) {
+ if (!control.getFont().isDisposed()) {
if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(text.computeSize(rect.width, org.eclipse.swt.SWT.DEFAULT)));
+ rect.setSize(new org.eclipse.draw2d.geometry.Dimension(control.computeSize(rect.width, org.eclipse.swt.SWT.DEFAULT)));
} else {
- int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(text.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
+ int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(control.getFont()).getAverageCharWidth();
+ rect.setSize(new org.eclipse.draw2d.geometry.Dimension(control.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
}
}
- if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(control.getBounds()))) {
+ control.setBounds(rect.x, rect.y, rect.width, rect.height);
}
}
}
@@ -108,15 +108,15 @@ public class «editPartFactoryClassName» implements org.eclipse.gef.EditPartFac
«EXPAND xpt::Common::generatedMemberComment»
public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
- org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl();
+ org.eclipse.swt.widgets.Control control = (org.eclipse.swt.widgets.Control) celleditor.getControl();
org.eclipse.draw2d.geometry.Rectangle rect = getLabel().getTextBounds().getCopy();
getLabel().translateToAbsolute(rect);
- if (!text.getFont().isDisposed()) {
- int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(text.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
+ if (!control.getFont().isDisposed()) {
+ int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(control.getFont()).getAverageCharWidth();
+ rect.setSize(new org.eclipse.draw2d.geometry.Dimension(control.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
}
- if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
- text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(control.getBounds()))) {
+ control.setBounds(rect.x, rect.y, rect.width, rect.height);
}
}
}