Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2014-07-27 08:59:35 -0400
committerHenrik Rentz-Reichert2014-07-27 08:59:35 -0400
commitb54584d041cbc6a47234743581f0424b53905ed1 (patch)
tree5b929c619659a67f0ec56ea3fcae0d4bfb0ec6f1
parent85332039dea58e98196a1df7186d43009c4c06d2 (diff)
downloadorg.eclipse.etrice-b54584d041cbc6a47234743581f0424b53905ed1.tar.gz
org.eclipse.etrice-b54584d041cbc6a47234743581f0424b53905ed1.tar.xz
org.eclipse.etrice-b54584d041cbc6a47234743581f0424b53905ed1.zip
Bug 440312: Refined transitions with the same names on different hierarchies
https://bugs.eclipse.org/440312 Use qualified names to distinguish. Change-Id: Ia42df0169eb2f13288a55dc2d23501389778a0b3
-rw-r--r--plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java43
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java5
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomQualifiedNameProvider.java4
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java10
-rw-r--r--plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java12
5 files changed, 48 insertions, 26 deletions
diff --git a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java
index 928322a30..8ac9c2624 100644
--- a/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java
+++ b/plugins/org.eclipse.etrice.core.common/xtend-gen/org/eclipse/etrice/core/common/postprocessing/PostprocessingHelpers.java
@@ -38,33 +38,39 @@ public class PostprocessingHelpers {
}
public static void setDocumentation(final EModelElement eModelElement, final String documentation) {
- EcoreUtil.setDocumentation(eModelElement, (PostprocessingHelpers.JAVADOC_NEWLINE + documentation));
+ String _plus = (PostprocessingHelpers.JAVADOC_NEWLINE + documentation);
+ EcoreUtil.setDocumentation(eModelElement, _plus);
}
public static EAttribute getAttribute(final EClass cls, final String name) {
EList<EAttribute> _eAllAttributes = cls.getEAllAttributes();
- final Function1<EAttribute, Boolean> _function = new Function1<EAttribute, Boolean>() {
- public Boolean apply(final EAttribute a) {
- String _name = a.getName();
- return Boolean.valueOf(_name.equals(name));
- }
- };
- return IterableExtensions.<EAttribute>findFirst(_eAllAttributes, _function);
+ final Function1<EAttribute,Boolean> _function = new Function1<EAttribute,Boolean>() {
+ public Boolean apply(final EAttribute a) {
+ String _name = a.getName();
+ boolean _equals = _name.equals(name);
+ return Boolean.valueOf(_equals);
+ }
+ };
+ EAttribute _findFirst = IterableExtensions.<EAttribute>findFirst(_eAllAttributes, _function);
+ return _findFirst;
}
public static EReference getReference(final EClass cls, final String name) {
EList<EReference> _eAllReferences = cls.getEAllReferences();
- final Function1<EReference, Boolean> _function = new Function1<EReference, Boolean>() {
- public Boolean apply(final EReference a) {
- String _name = a.getName();
- return Boolean.valueOf(_name.equals(name));
- }
- };
- return IterableExtensions.<EReference>findFirst(_eAllReferences, _function);
+ final Function1<EReference,Boolean> _function = new Function1<EReference,Boolean>() {
+ public Boolean apply(final EReference a) {
+ String _name = a.getName();
+ boolean _equals = _name.equals(name);
+ return Boolean.valueOf(_equals);
+ }
+ };
+ EReference _findFirst = IterableExtensions.<EReference>findFirst(_eAllReferences, _function);
+ return _findFirst;
}
public static boolean addOperation(final EClass owner, final String name, final EClassifier type, final String body) {
- return PostprocessingHelpers.addOperation(owner, name, type, Integer.valueOf(1), body);
+ boolean _addOperation = PostprocessingHelpers.addOperation(owner, name, type, Integer.valueOf(1), body);
+ return _addOperation;
}
public static boolean addOperation(final EClass owner, final String name, final EClassifier type, final Integer upperBound, final String body) {
@@ -76,12 +82,13 @@ public class PostprocessingHelpers {
op.setUpperBound((upperBound).intValue());
final EAnnotation anno = EcoreFactory.eINSTANCE.createEAnnotation();
anno.setSource("http://www.eclipse.org/emf/2002/GenModel");
- EMap<String, String> _details = anno.getDetails();
+ EMap<String,String> _details = anno.getDetails();
_details.put("body", body);
EList<EAnnotation> _eAnnotations = op.getEAnnotations();
_eAnnotations.add(anno);
EList<EOperation> _eOperations = owner.getEOperations();
- _xblockexpression = _eOperations.add(op);
+ boolean _add = _eOperations.add(op);
+ _xblockexpression = (_add);
}
return _xblockexpression;
}
diff --git a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
index 43c5cd59e..f07776e8b 100644
--- a/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel/src/org/eclipse/etrice/core/genmodel/etricegen/impl/ExpandedActorClassImpl.java
@@ -313,7 +313,10 @@ public class ExpandedActorClassImpl extends EObjectImpl implements ExpandedActor
}
private void validationError(String msg, EObject obj, EStructuralFeature feature, int idx) {
- assert obj.eResource() != null : "val error in artificial model object";
+// assert obj.eResource() != null : "val error in artificial model object";
+ if (obj.eResource()==null) {
+ obj = copy2orig.get(obj);
+ }
validator.error(msg, obj, feature, idx);
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomQualifiedNameProvider.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomQualifiedNameProvider.java
index cd9478e8e..9d4dc51dd 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomQualifiedNameProvider.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/naming/RoomQualifiedNameProvider.java
@@ -20,8 +20,8 @@ import org.eclipse.etrice.core.room.ActorClass;
import org.eclipse.etrice.core.room.Message;
import org.eclipse.etrice.core.room.PortClass;
import org.eclipse.etrice.core.room.ProtocolClass;
-import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.RefinedState;
+import org.eclipse.etrice.core.room.StandardOperation;
import org.eclipse.etrice.core.room.State;
import org.eclipse.etrice.core.room.StateGraph;
import org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider;
@@ -77,7 +77,7 @@ public class RoomQualifiedNameProvider extends
public QualifiedName qualifiedName(StateGraph sg) {
if (sg.eContainer() instanceof State)
- return getFullyQualifiedName(sg.eContainer()).append("subgraph");
+ return getFullyQualifiedName(sg.eContainer()).append("sg");
else if (sg.eContainer() instanceof ActorClass)
return getFullyQualifiedName(sg.eContainer()).append("sm");
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
index 0527ae76b..bf62e3ab0 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/RoomScopeProvider.java
@@ -64,6 +64,7 @@ import org.eclipse.etrice.core.room.TrPoint;
import org.eclipse.etrice.core.room.TrPointTerminal;
import org.eclipse.etrice.core.room.Transition;
import org.eclipse.etrice.core.room.util.RoomHelpers;
+import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.EObjectDescription;
import org.eclipse.xtext.resource.IEObjectDescription;
@@ -71,6 +72,8 @@ import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.scoping.impl.SimpleScope;
+import com.google.inject.Inject;
+
/**
* This class contains custom scoping description.
@@ -83,6 +86,9 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
public static final String STATE_PATH_DELIMITER = ".";
+ @Inject
+ private IQualifiedNameProvider nameProvider;
+
/**
* first container of type {@link StateGraph} ({@link State}, {@link StateMachine})
* @param obj
@@ -546,11 +552,13 @@ public class RoomScopeProvider extends AbstractDeclarativeScopeProvider {
ac = ac.getBase();
while (ac!=null) {
if (ac.getStateMachine()!=null) {
+ int acNameSegments = nameProvider.getFullyQualifiedName(ac).getSegmentCount();
TreeIterator<EObject> it = ac.getStateMachine().eAllContents();
while (it.hasNext()) {
EObject obj = it.next();
if (obj instanceof Transition) {
- scopes.add(EObjectDescription.create(((Transition)obj).getName(), obj));
+ // use qualified name but skip ac FQN and also omit state machine name 'sm'
+ scopes.add(EObjectDescription.create(nameProvider.getFullyQualifiedName(obj).skipFirst(acNameSegments+1), obj));
}
}
}
diff --git a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java b/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java
index b10a9c689..c3954aabc 100644
--- a/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java
+++ b/plugins/org.eclipse.etrice.core.room/xtend-gen/org/eclipse/etrice/core/postprocessing/ImplPostprocessor.java
@@ -89,6 +89,7 @@ public class ImplPostprocessor {
PostprocessingHelpers.addOperation(interfaceItem, "getGeneralProtocol", _eClassifier_3, Integer.valueOf(1), _builder_3.toString());
final EClass actorClass = PostprocessingHelpers.getClass(roomPackage, "ActorClass");
EClassifier _eClassifier_4 = roomPackage.getEClassifier("Port");
+ int _minus = (-1);
StringConcatenation _builder_4 = new StringConcatenation();
_builder_4.append("EList<Port> ports = new org.eclipse.emf.common.util.BasicEList<Port>();");
_builder_4.newLine();
@@ -101,8 +102,9 @@ public class ImplPostprocessor {
_builder_4.newLine();
_builder_4.append("return ports;");
_builder_4.newLine();
- PostprocessingHelpers.addOperation(actorClass, "getExternalEndPorts", _eClassifier_4, Integer.valueOf((-1)), _builder_4.toString());
+ PostprocessingHelpers.addOperation(actorClass, "getExternalEndPorts", _eClassifier_4, Integer.valueOf(_minus), _builder_4.toString());
EClassifier _eClassifier_5 = roomPackage.getEClassifier("Port");
+ int _minus_1 = (-1);
StringConcatenation _builder_5 = new StringConcatenation();
_builder_5.append("EList<Port> ports = new org.eclipse.emf.common.util.BasicEList<Port>(getInterfacePorts());");
_builder_5.newLine();
@@ -115,8 +117,9 @@ public class ImplPostprocessor {
_builder_5.newLine();
_builder_5.append("return ports;");
_builder_5.newLine();
- PostprocessingHelpers.addOperation(actorClass, "getRelayPorts", _eClassifier_5, Integer.valueOf((-1)), _builder_5.toString());
+ PostprocessingHelpers.addOperation(actorClass, "getRelayPorts", _eClassifier_5, Integer.valueOf(_minus_1), _builder_5.toString());
EClassifier _eClassifier_6 = roomPackage.getEClassifier("SPP");
+ int _minus_2 = (-1);
StringConcatenation _builder_6 = new StringConcatenation();
_builder_6.append("EList<SPP> spps = new org.eclipse.emf.common.util.BasicEList<SPP>();");
_builder_6.newLine();
@@ -129,7 +132,7 @@ public class ImplPostprocessor {
_builder_6.newLine();
_builder_6.append("return spps;");
_builder_6.newLine();
- PostprocessingHelpers.addOperation(actorClass, "getImplementedSPPs", _eClassifier_6, Integer.valueOf((-1)), _builder_6.toString());
+ PostprocessingHelpers.addOperation(actorClass, "getImplementedSPPs", _eClassifier_6, Integer.valueOf(_minus_2), _builder_6.toString());
final EClass actorContainerRef = PostprocessingHelpers.getClass(roomPackage, "ActorContainerRef");
EClassifier _eClassifier_7 = roomPackage.getEClassifier("StructureClass");
StringConcatenation _builder_7 = new StringConcatenation();
@@ -209,9 +212,10 @@ public class ImplPostprocessor {
_builder_11.newLine();
_builder_11.append("return et.getName() + \".\" + this.getName();");
_builder_11.newLine();
- _xblockexpression = PostprocessingHelpers.addOperation(enumLiteral,
+ boolean _addOperation = PostprocessingHelpers.addOperation(enumLiteral,
"getFullName", _eClassifier_11,
Integer.valueOf(1), _builder_11.toString());
+ _xblockexpression = (_addOperation);
}
return _xblockexpression;
}

Back to the top