From 7cd802923e7efb64bad5fd23250b711ddc4c0c94 Mon Sep 17 00:00:00 2001
From: Henrik Rentz-Reichert
Date: Fri, 10 Apr 2015 08:54:04 +0200
Subject: refactorings for abstract FSM interface
Change-Id: I527dc0c2a00d40873385e707e279254114d7a998
---
.../META-INF/MANIFEST.MF | 3 +-
.../model/generated/FSM.ecore | 5 +
.../model/generated/FSM.genmodel | 1 +
.../etrice/core/fsm/fSM/AbstractInterfaceItem.java | 18 ++++
.../fsm/fSM/impl/AbstractInterfaceItemImpl.java | 21 +++++
.../etrice/core/fsm/fSM/impl/FSMPackageImpl.java | 4 +
.../fsm/validation/AbstractFSMJavaValidator.java | 2 +-
.../org/eclipse/etrice/core/fsm/GenerateFSM.mwe2 | 1 -
.../etrice/core/fsm/naming/FSMNameProvider.java | 10 +-
.../fsm/postprocessing/ImplPostprocessor.xtend | 6 ++
.../eclipse/etrice/core/fsm/util/FSMHelpers.java | 101 ++++++++++++++++++++-
.../core/fsm/validation/FSMJavaValidator.java | 86 ++++++++++++++++--
.../core/fsm/validation/FSMValidationUtil.java | 4 +-
.../core/fsm/postprocessing/ImplPostprocessor.java | 16 +++-
14 files changed, 260 insertions(+), 18 deletions(-)
(limited to 'plugins/org.eclipse.etrice.core.fsm')
diff --git a/plugins/org.eclipse.etrice.core.fsm/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.fsm/META-INF/MANIFEST.MF
index cc542e5ca..b4658f6c3 100644
--- a/plugins/org.eclipse.etrice.core.fsm/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.core.fsm/META-INF/MANIFEST.MF
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.etrice.core.common;bundle-version="0.5.0",
org.eclipse.emf.ecore,
org.eclipse.emf.common,
org.antlr.runtime,
- org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional
+ org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional,
+ com.google.guava
Import-Package: org.apache.log4j,
org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/plugins/org.eclipse.etrice.core.fsm/model/generated/FSM.ecore b/plugins/org.eclipse.etrice.core.fsm/model/generated/FSM.ecore
index f163179ba..631bfa5d7 100644
--- a/plugins/org.eclipse.etrice.core.fsm/model/generated/FSM.ecore
+++ b/plugins/org.eclipse.etrice.core.fsm/model/generated/FSM.ecore
@@ -382,6 +382,11 @@
+
+
+
+
+
diff --git a/plugins/org.eclipse.etrice.core.fsm/model/generated/FSM.genmodel b/plugins/org.eclipse.etrice.core.fsm/model/generated/FSM.genmodel
index 059539ebe..edc632ee8 100644
--- a/plugins/org.eclipse.etrice.core.fsm/model/generated/FSM.genmodel
+++ b/plugins/org.eclipse.etrice.core.fsm/model/generated/FSM.genmodel
@@ -114,6 +114,7 @@
+
diff --git a/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/AbstractInterfaceItem.java b/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/AbstractInterfaceItem.java
index cbb587717..0c28be60e 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/AbstractInterfaceItem.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/AbstractInterfaceItem.java
@@ -55,6 +55,15 @@ public interface AbstractInterfaceItem extends EObject
*/
void setName(String value);
+ /**
+ *
+ *
+ * @model kind="operation"
+ * annotation="http://www.eclipse.org/emf/2002/GenModel body='return getName();\n'"
+ * @generated
+ */
+ String getDisplayName();
+
/**
*
*
@@ -79,4 +88,13 @@ public interface AbstractInterfaceItem extends EObject
*/
EList getAllOutgoingAbstractMessages();
+ /**
+ *
+ *
+ * @model kind="operation"
+ * annotation="http://www.eclipse.org/emf/2002/GenModel body='return true;'"
+ * @generated
+ */
+ boolean isEventDriven();
+
} // AbstractInterfaceItem
diff --git a/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/impl/AbstractInterfaceItemImpl.java b/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/impl/AbstractInterfaceItemImpl.java
index 55a229c4a..0bb61939e 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/impl/AbstractInterfaceItemImpl.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/impl/AbstractInterfaceItemImpl.java
@@ -95,6 +95,17 @@ public class AbstractInterfaceItemImpl extends MinimalEObjectImpl.Container impl
eNotify(new ENotificationImpl(this, Notification.SET, FSMPackage.ABSTRACT_INTERFACE_ITEM__NAME, oldName, name));
}
+ /**
+ *
+ *
+ * @generated
+ */
+ public String getDisplayName()
+ {
+ return getName();
+
+ }
+
/**
*
*
@@ -131,6 +142,16 @@ public class AbstractInterfaceItemImpl extends MinimalEObjectImpl.Container impl
throw new UnsupportedOperationException();
}
+ /**
+ *
+ *
+ * @generated
+ */
+ public boolean isEventDriven()
+ {
+ return true;
+ }
+
/**
*
*
diff --git a/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/impl/FSMPackageImpl.java b/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/impl/FSMPackageImpl.java
index e4453e4f0..62d9d5d66 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/impl/FSMPackageImpl.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/fSM/impl/FSMPackageImpl.java
@@ -1589,12 +1589,16 @@ public class FSMPackageImpl extends EPackageImpl implements FSMPackage
initEClass(abstractInterfaceItemEClass, AbstractInterfaceItem.class, "AbstractInterfaceItem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getAbstractInterfaceItem_Name(), ecorePackage.getEString(), "name", null, 0, 1, AbstractInterfaceItem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ addEOperation(abstractInterfaceItemEClass, ecorePackage.getEString(), "getDisplayName", 0, 1, IS_UNIQUE, IS_ORDERED);
+
addEOperation(abstractInterfaceItemEClass, this.getProtocolSemantics(), "getSemantics", 0, 1, IS_UNIQUE, IS_ORDERED);
addEOperation(abstractInterfaceItemEClass, ecorePackage.getEObject(), "getAllIncomingAbstractMessages", 0, -1, IS_UNIQUE, IS_ORDERED);
addEOperation(abstractInterfaceItemEClass, ecorePackage.getEObject(), "getAllOutgoingAbstractMessages", 0, -1, IS_UNIQUE, IS_ORDERED);
+ addEOperation(abstractInterfaceItemEClass, ecorePackage.getEBoolean(), "isEventDriven", 0, 1, IS_UNIQUE, IS_ORDERED);
+
initEClass(guardEClass, Guard.class, "Guard", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getGuard_Guard(), this.getDetailCode(), null, "guard", null, 0, 1, Guard.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
diff --git a/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/validation/AbstractFSMJavaValidator.java b/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/validation/AbstractFSMJavaValidator.java
index dffe9b425..4abc7a50e 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/validation/AbstractFSMJavaValidator.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src-gen/org/eclipse/etrice/core/fsm/validation/AbstractFSMJavaValidator.java
@@ -9,7 +9,7 @@ import java.util.List;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.xtext.validation.ComposedChecks;
-@ComposedChecks(validators= {org.eclipse.xtext.validation.ImportUriValidator.class, org.eclipse.xtext.validation.NamesAreUniqueValidator.class})
+@ComposedChecks(validators= {org.eclipse.xtext.validation.ImportUriValidator.class})
public class AbstractFSMJavaValidator extends org.eclipse.etrice.core.common.validation.BaseJavaValidator {
@Override
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/GenerateFSM.mwe2 b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/GenerateFSM.mwe2
index aecba1b99..412df2b89 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/GenerateFSM.mwe2
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/GenerateFSM.mwe2
@@ -87,7 +87,6 @@ Workflow {
// Added for compatibility with existing eTrice subgrammars
fragment = validation.JavaValidatorFragment auto-inject {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
- composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
// old scoping and exporting API
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/naming/FSMNameProvider.java b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/naming/FSMNameProvider.java
index ced2df965..0313673ba 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/naming/FSMNameProvider.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/naming/FSMNameProvider.java
@@ -222,11 +222,19 @@ public class FSMNameProvider {
return result;
}
+ public String getTerminalLabel(TransitionTerminal tt) {
+ return getTerminalName(tt, "/");
+ }
+
/**
* @param tt a {@link TransitionTerminal}
* @return a name for the terminal
*/
private String getTerminalName(TransitionTerminal tt) {
+ return getTerminalName(tt, PATH_SEP);
+ }
+
+ private String getTerminalName(TransitionTerminal tt, String sep) {
if (tt instanceof StateTerminal) {
return getStateName(((StateTerminal) tt).getState());
}
@@ -234,7 +242,7 @@ public class FSMNameProvider {
return ((TrPointTerminal) tt).getTrPoint().getName();
}
else if (tt instanceof SubStateTrPointTerminal) {
- return getStatePathName(((SubStateTrPointTerminal) tt).getState())+PATH_SEP+((SubStateTrPointTerminal) tt).getTrPoint().getName();
+ return getStatePathName(((SubStateTrPointTerminal) tt).getState())+sep+((SubStateTrPointTerminal) tt).getTrPoint().getName();
}
else if (tt instanceof ChoicepointTerminal) {
return ((ChoicepointTerminal) tt).getCp().getName();
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.xtend b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.xtend
index fb2230d8d..20cb892f0 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.xtend
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.xtend
@@ -43,9 +43,15 @@ class ImplPostprocessor {
''')
val ifItem = fsmPackage.getClass("AbstractInterfaceItem")
+ ifItem.addOperation("getDisplayName", EcorePackage::eINSTANCE.getEClassifier("EString"), 1,
+ '''
+ return getName();
+ '''
+ )
ifItem.addOperation("getSemantics", fsmPackage.getEClassifier("ProtocolSemantics"))
ifItem.addOperation("getAllIncomingAbstractMessages", EcorePackage.Literals.EOBJECT, -1, null)
ifItem.addOperation("getAllOutgoingAbstractMessages", EcorePackage.Literals.EOBJECT, -1, null)
+ ifItem.addOperation("isEventDriven", EcorePackage.Literals.EBOOLEAN, 1, "return true;")
val itemOwner = fsmPackage.addClass("IInterfaceItemOwner")
itemOwner.setAbstract(true)
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
index 67930eecd..55f79201d 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/util/FSMHelpers.java
@@ -24,11 +24,14 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.etrice.core.common.base.util.BaseHelpers;
+import org.eclipse.etrice.core.fsm.fSM.AbstractInterfaceItem;
import org.eclipse.etrice.core.fsm.fSM.ChoicePoint;
import org.eclipse.etrice.core.fsm.fSM.ChoicepointTerminal;
import org.eclipse.etrice.core.fsm.fSM.DetailCode;
import org.eclipse.etrice.core.fsm.fSM.FSMFactory;
import org.eclipse.etrice.core.fsm.fSM.FSMPackage;
+import org.eclipse.etrice.core.fsm.fSM.InitialTransition;
+import org.eclipse.etrice.core.fsm.fSM.MessageFromIf;
import org.eclipse.etrice.core.fsm.fSM.ModelComponent;
import org.eclipse.etrice.core.fsm.fSM.RefinedState;
import org.eclipse.etrice.core.fsm.fSM.RefinedTransition;
@@ -1085,7 +1088,7 @@ public class FSMHelpers extends BaseHelpers {
* Returns the complete action code including base class code of a {@link Transition}.
*
* @param trans the transition
- * @param ac the model component
+ * @param mc the model component
*
* @return the complete action code including base class code of a {@link Transition}
*/
@@ -1122,4 +1125,100 @@ public class FSMHelpers extends BaseHelpers {
return null;
}
+ /**
+ * @param mc an {@link ModelComponent}
+ * @return a list of {@link MessageFromIf} that may come in through one of the
+ * event driven interface items of this actor class (without inherited ones)
+ */
+ public List getMessagesFromInterfaces(ModelComponent mc) {
+ ArrayList result = new ArrayList();
+
+ List items = mc.getAbstractInterfaceItems();
+ for (AbstractInterfaceItem item : items) {
+ for (EObject msg : item.getAllIncomingAbstractMessages()) {
+ MessageFromIf mif = FSMFactory.eINSTANCE.createMessageFromIf();
+ mif.setMessage(msg);
+ mif.setFrom(item);
+ result.add(mif);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * @param mc an {@link ModelComponent}
+ * @return a list of {@link MessageFromIf} that may come in through one of the
+ * event driven interface items of this actor class (with inherited ones as far as a base class has its own state machine)
+ */
+ public List getOwnMessagesFromInterfaces(ModelComponent mc) {
+ ArrayList result = new ArrayList();
+
+ result.addAll(getMessagesFromInterfaces(mc));
+ mc = mc.getBase();
+ while (mc!=null) {
+ if (hasNonEmptyStateMachine(mc))
+ break;
+
+ List items = mc.getAbstractInterfaceItems();
+ for (AbstractInterfaceItem item : items) {
+ for (EObject msg : item.getAllIncomingAbstractMessages()) {
+ MessageFromIf mif = FSMFactory.eINSTANCE.createMessageFromIf();
+ mif.setMessage(msg);
+ mif.setFrom(item);
+ result.add(mif);
+ }
+ }
+
+ mc = mc.getBase();
+ }
+
+ return result;
+ }
+
+ /**
+ * @param mc an {@link ModelComponent}
+ * @return a list of {@link MessageFromIf} that may come in through one of the
+ * event driven interface items of this actor class(including inherited ones)
+ */
+ public List getAllMessagesFromInterfaces(ModelComponent mc) {
+ ArrayList result = new ArrayList();
+
+ while (mc!=null) {
+ List items = mc.getAbstractInterfaceItems();
+ for (AbstractInterfaceItem item : items) {
+ for (EObject msg : item.getAllIncomingAbstractMessages()) {
+ MessageFromIf mif = FSMFactory.eINSTANCE.createMessageFromIf();
+ mif.setMessage(msg);
+ mif.setFrom(item);
+ result.add(mif);
+ }
+ }
+
+ mc = mc.getBase();
+ }
+
+ return result;
+ }
+
+ /**
+ * @param sg a {@link StateGraph}
+ * @return the initial transition or null
if no such is available
+ */
+ public Transition getInitTransition(StateGraph sg) {
+ for (Transition tr : sg.getTransitions()) {
+ if (tr instanceof InitialTransition)
+ return tr;
+ }
+ return null;
+ }
+
+ /**
+ * @param sg a {@link StateGraph}
+ * @return true
if an initial transition is available
+ */
+ public boolean hasInitTransition(StateGraph sg) {
+ return getInitTransition(sg)!=null;
+ }
+
}
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/validation/FSMJavaValidator.java b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/validation/FSMJavaValidator.java
index 538385c70..79326fb2f 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/validation/FSMJavaValidator.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/validation/FSMJavaValidator.java
@@ -4,9 +4,11 @@
package org.eclipse.etrice.core.fsm.validation;
import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.etrice.core.fsm.fSM.ChoicePoint;
import org.eclipse.etrice.core.fsm.fSM.DetailCode;
import org.eclipse.etrice.core.fsm.fSM.FSMPackage;
@@ -17,12 +19,15 @@ import org.eclipse.etrice.core.fsm.fSM.RefinedState;
import org.eclipse.etrice.core.fsm.fSM.RefinedTransition;
import org.eclipse.etrice.core.fsm.fSM.SimpleState;
import org.eclipse.etrice.core.fsm.fSM.StateGraph;
+import org.eclipse.etrice.core.fsm.fSM.StateGraphItem;
import org.eclipse.etrice.core.fsm.fSM.TrPoint;
import org.eclipse.etrice.core.fsm.fSM.Transition;
import org.eclipse.etrice.core.fsm.validation.FSMValidationUtilXtend.Result;
import org.eclipse.xtext.util.Strings;
import org.eclipse.xtext.validation.Check;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
import com.google.inject.Inject;
/**
@@ -55,9 +60,9 @@ public class FSMJavaValidator extends org.eclipse.etrice.core.fsm.validation.Abs
@Check
public void checkStateNameUnique(SimpleState s) {
- Result result = ValidationUtil.isUniqueName(s, s.getName());
- if (!result.isOk())
- error(result.getMsg(), FSMPackage.Literals.SIMPLE_STATE__NAME);
+// Result result = ValidationUtil.isUniqueName(s, s.getName());
+// if (!result.isOk())
+// error(result.getMsg(), FSMPackage.Literals.SIMPLE_STATE__NAME);
}
@Check
@@ -69,8 +74,8 @@ public class FSMJavaValidator extends org.eclipse.etrice.core.fsm.validation.Abs
@Check
public void checkChoicePoint(ChoicePoint cp) {
- if (!ValidationUtil.isUniqueName(cp, cp.getName()).isOk())
- error("name is not unique", FSMPackage.Literals.CHOICE_POINT__NAME);
+// if (!ValidationUtil.isUniqueName(cp, cp.getName()).isOk())
+// error("name is not unique", FSMPackage.Literals.CHOICE_POINT__NAME);
}
@Check
@@ -124,7 +129,76 @@ public class FSMJavaValidator extends org.eclipse.etrice.core.fsm.validation.Abs
}
}
- private void error(Result result) {
+ @Check
+ public void checkUniqueNamesInStateGraph(StateGraph sg) {
+ Multimap names2items = ArrayListMultimap.create();
+
+ // fill the multimap with all objects
+ do {
+ for (org.eclipse.etrice.core.fsm.fSM.State st : sg.getStates()) {
+ // the parent state of refined states is in this scope - so we don't add the name now
+ if (!(st instanceof RefinedState)) {
+ names2items.put(st.getName(), st);
+ }
+ }
+ for (TrPoint tp : sg.getTrPoints()) {
+ names2items.put(tp.getName(), tp);
+ }
+ for (ChoicePoint cp : sg.getChPoints()) {
+ names2items.put(cp.getName(), cp);
+ }
+ for (Transition tr : sg.getTransitions()) {
+ names2items.put(tr.getName(), tr);
+ }
+
+ if (sg.eContainer() instanceof RefinedState) {
+ sg = ((RefinedState)sg.eContainer()).getTarget().getSubgraph();
+ }
+ else if (sg.eContainer() instanceof ModelComponent) {
+ ModelComponent base = ((ModelComponent)sg.eContainer()).getBase();
+ sg = base!=null? base.getStateMachine():null;
+ }
+ else {
+ break;
+ }
+ }
+ while (sg!=null);
+
+ // check for duplicates
+ for (String key: names2items.keySet()) {
+ Collection list = names2items.get(key);
+ if (list.size()>1) {
+ for (StateGraphItem item: list) {
+ error("Name is not unique in state graph (including super graph)", item, getNameFeature(item));
+ }
+ }
+ }
+ }
+
+ /**
+ * @param item
+ * @return
+ */
+ private EStructuralFeature getNameFeature(StateGraphItem item) {
+ if (item instanceof SimpleState) {
+ return FSMPackage.Literals.SIMPLE_STATE__NAME;
+ }
+ else if (item instanceof ChoicePoint) {
+ return FSMPackage.Literals.CHOICE_POINT__NAME;
+ }
+ else if (item instanceof TrPoint) {
+ return FSMPackage.Literals.TR_POINT__NAME;
+ }
+ else if (item instanceof Transition) {
+ return FSMPackage.Literals.TRANSITION__NAME;
+ }
+ else {
+ assert(false): "internal error: unexpected sub type";
+ return null;
+ }
+ }
+
+ private void error(Result result) {
error(result.getMsg(), result.getSource(), result.getFeature(), result.getIndex());
}
}
diff --git a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/validation/FSMValidationUtil.java b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/validation/FSMValidationUtil.java
index d17bb195f..f8180676d 100644
--- a/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/validation/FSMValidationUtil.java
+++ b/plugins/org.eclipse.etrice.core.fsm/src/org/eclipse/etrice/core/fsm/validation/FSMValidationUtil.java
@@ -174,8 +174,8 @@ public class FSMValidationUtil extends FSMValidationUtilXtend {
}
public Result isValid(TrPoint tp) {
- if (!isUniqueName(tp, tp.getName()).isOk())
- return Result.error("name is not unique", tp, FSMPackage.Literals.TR_POINT__NAME);
+// if (!isUniqueName(tp, tp.getName()).isOk())
+// return Result.error("name is not unique", tp, FSMPackage.Literals.TR_POINT__NAME);
if (tp instanceof TransitionPoint)
return Result.ok();
diff --git a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java
index ede3a8b47..3c6306ffc 100644
--- a/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java
+++ b/plugins/org.eclipse.etrice.core.fsm/xtend-gen/org/eclipse/etrice/core/fsm/postprocessing/ImplPostprocessor.java
@@ -56,17 +56,23 @@ public class ImplPostprocessor {
_builder_1.newLine();
PostprocessingHelpers.addOperation(stateGraphItem, "getName", _eClassifier, Integer.valueOf(1), _builder_1.toString());
final EClass ifItem = PostprocessingHelpers.getClass(fsmPackage, "AbstractInterfaceItem");
- EClassifier _eClassifier_1 = fsmPackage.getEClassifier("ProtocolSemantics");
- PostprocessingHelpers.addOperation(ifItem, "getSemantics", _eClassifier_1);
+ EClassifier _eClassifier_1 = EcorePackage.eINSTANCE.getEClassifier("EString");
+ StringConcatenation _builder_2 = new StringConcatenation();
+ _builder_2.append("return getName();");
+ _builder_2.newLine();
+ PostprocessingHelpers.addOperation(ifItem, "getDisplayName", _eClassifier_1, Integer.valueOf(1), _builder_2.toString());
+ EClassifier _eClassifier_2 = fsmPackage.getEClassifier("ProtocolSemantics");
+ PostprocessingHelpers.addOperation(ifItem, "getSemantics", _eClassifier_2);
PostprocessingHelpers.addOperation(ifItem, "getAllIncomingAbstractMessages", EcorePackage.Literals.EOBJECT, Integer.valueOf((-1)), null);
PostprocessingHelpers.addOperation(ifItem, "getAllOutgoingAbstractMessages", EcorePackage.Literals.EOBJECT, Integer.valueOf((-1)), null);
+ PostprocessingHelpers.addOperation(ifItem, "isEventDriven", EcorePackage.Literals.EBOOLEAN, Integer.valueOf(1), "return true;");
final EClass itemOwner = PostprocessingHelpers.addClass(fsmPackage, "IInterfaceItemOwner");
itemOwner.setAbstract(true);
itemOwner.setInterface(true);
- EClassifier _eClassifier_2 = fsmPackage.getEClassifier("AbstractInterfaceItem");
- PostprocessingHelpers.addOperation(itemOwner, "getAbstractInterfaceItems", _eClassifier_2, Integer.valueOf((-1)), null);
EClassifier _eClassifier_3 = fsmPackage.getEClassifier("AbstractInterfaceItem");
- PostprocessingHelpers.addOperation(itemOwner, "getAllAbstractInterfaceItems", _eClassifier_3, Integer.valueOf((-1)), null);
+ PostprocessingHelpers.addOperation(itemOwner, "getAbstractInterfaceItems", _eClassifier_3, Integer.valueOf((-1)), null);
+ EClassifier _eClassifier_4 = fsmPackage.getEClassifier("AbstractInterfaceItem");
+ PostprocessingHelpers.addOperation(itemOwner, "getAllAbstractInterfaceItems", _eClassifier_4, Integer.valueOf((-1)), null);
final EClass comp = PostprocessingHelpers.getClass(fsmPackage, "ModelComponent");
EList _eSuperTypes = comp.getESuperTypes();
_xblockexpression = _eSuperTypes.add(itemOwner);
--
cgit v1.2.3