Commit b9919736 authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+refined resolution of gate references in interactions



Change-Id: I84a0114d163683ea28200cec9685b8d7c8ff1dcf
Signed-off-by: Philip Makedonski's avatarmakedonski <makedonski@informatik.uni-goettingen.de>
parent ab8f83f4
...@@ -6,6 +6,8 @@ import org.eclipse.emf.ecore.EObject; ...@@ -6,6 +6,8 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.EReference;
import org.eclipse.xtext.naming.IQualifiedNameConverter; import org.eclipse.xtext.naming.IQualifiedNameConverter;
import org.eclipse.xtext.naming.QualifiedName; import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.nodemodel.ICompositeNode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.scoping.IScope; import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.Scopes; import org.eclipse.xtext.scoping.Scopes;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
...@@ -30,6 +32,7 @@ import org.etsi.mts.tdl.LocalExpression; ...@@ -30,6 +32,7 @@ import org.etsi.mts.tdl.LocalExpression;
import org.etsi.mts.tdl.Member; import org.etsi.mts.tdl.Member;
import org.etsi.mts.tdl.MemberAssignment; import org.etsi.mts.tdl.MemberAssignment;
import org.etsi.mts.tdl.MemberReference; import org.etsi.mts.tdl.MemberReference;
import org.etsi.mts.tdl.Message;
import org.etsi.mts.tdl.Package; import org.etsi.mts.tdl.Package;
import org.etsi.mts.tdl.PackageableElement; import org.etsi.mts.tdl.PackageableElement;
import org.etsi.mts.tdl.Parameter; import org.etsi.mts.tdl.Parameter;
...@@ -109,7 +112,33 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider { ...@@ -109,7 +112,33 @@ public class TDLan2ScopeProvider extends AbstractDeclarativeScopeProvider {
TestConfiguration configuration = getTestDescription((Element) context).getTestConfiguration(); TestConfiguration configuration = getTestDescription((Element) context).getTestConfiguration();
EList<EObject> elements = new BasicEList<>(); EList<EObject> elements = new BasicEList<>();
for (Connection c : configuration.getConnection()) { for (Connection c : configuration.getConnection()) {
elements.addAll(c.getEndPoint()); if (context instanceof Message) {
ICompositeNode oppositeNode = NodeModelUtils.findActualNodeFor(((Message) context).getTarget().get(0));
String targetGateName = oppositeNode.getText().trim();
if (targetGateName.startsWith(c.getEndPoint().get(0).getComponent().getName()) &&
targetGateName.endsWith(c.getEndPoint().get(0).getGate().getName())) {
elements.add(c.getEndPoint().get(1));
} else if (targetGateName.startsWith(c.getEndPoint().get(1).getComponent().getName()) &&
targetGateName.endsWith(c.getEndPoint().get(1).getGate().getName())) {
elements.add(c.getEndPoint().get(0));
}
// GateReference opposite = ((Message) context).getTarget().get(0).getTargetGate();
// if (c.getEndPoint().get(0) == opposite) {
// elements.add(c.getEndPoint().get(1));
// } else if (c.getEndPoint().get(1) == opposite) {
// elements.add(c.getEndPoint().get(0));
// }
} else if (context instanceof Target) {
GateReference opposite = ((Message) context.eContainer()).getSourceGate();
if (c.getEndPoint().get(0) == opposite) {
elements.add(c.getEndPoint().get(1));
} else if (c.getEndPoint().get(1) == opposite) {
elements.add(c.getEndPoint().get(0));
}
} else {
elements.addAll(c.getEndPoint());
}
} }
IScope scope = Scopes.scopeFor(elements, new Function<EObject, QualifiedName>() { IScope scope = Scopes.scopeFor(elements, new Function<EObject, QualifiedName>() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment