blob: fdedf388cd3fe081b2cf01aac4f088bc619ea901 [file] [log] [blame]
diff --git org.eclipse.epsilon.eugenia.examples.executablestatemachine.graphical.diagram/src/esm/diagram/parsers/ActionXtext2GmfParser.java org.eclipse.epsilon.eugenia.examples.executablestatemachine.graphical.diagram/src/esm/diagram/parsers/ActionXtext2GmfParser.java
index 950bccd..34869f9 100644
--- org.eclipse.epsilon.eugenia.examples.executablestatemachine.graphical.diagram/src/esm/diagram/parsers/ActionXtext2GmfParser.java
+++ org.eclipse.epsilon.eugenia.examples.executablestatemachine.graphical.diagram/src/esm/diagram/parsers/ActionXtext2GmfParser.java
@@ -28,6 +28,16 @@
/**
* @generated
*/
+ private ActionParser parser = ActionParser.create();
+
+ /**
+ * @generated
+ */
+ private ActionGlue glue = new ActionGlue();
+
+ /**
+ * @generated
+ */
public ActionXtext2GmfParser(EAttribute[] features) {
super(features);
if (features.length != 1) {
@@ -66,7 +76,14 @@
*/
public IParserEditStatus isValidEditString(IAdaptable adapter,
String editString) {
- return ParserEditStatus.EDITABLE_STATUS;
+ final Collection<?> issues = parser.validate(editString);
+
+ if (issues.isEmpty()) {
+ return ParserEditStatus.EDITABLE_STATUS;
+ } else {
+ return new ParserEditStatus(EsmDiagramEditorPlugin.ID,
+ IParserEditStatus.UNEDITABLE, issues.toString());
+ }
}
/**
@@ -76,7 +93,13 @@
int flags) {
Object value = EcoreUtil.createFromString(
editableFeatures[0].getEAttributeType(), newString);
- return getParseCommand(adapter, new Object[] { value }, flags);
+ ICommand textCommand = getParseCommand(adapter, new Object[] { value },
+ flags);
+ EObject modelElement = (EObject) adapter.getAdapter(EObject.class);
+ SetRequest request = new SetRequest(modelElement,
+ glue.targetFor(features), parser.parse(newString));
+ SetValueCommand setValueCommand = new SetValueCommand(request);
+ return textCommand.compose(setValueCommand);
}
/**