Loading plugins/org.etsi.mts.tdl.common/src/org/etsi/mts/tdl/scoping/TDLScopeProvider.java +61 −6 Original line number Diff line number Diff line Loading @@ -68,6 +68,9 @@ import org.etsi.mts.tdl.ValueAssignment; import org.etsi.mts.tdl.Variable; import org.etsi.mts.tdl.VariableUse; import org.etsi.mts.tdl.tdlPackage; import org.etsi.mts.tdl.extendedconfigurations.ComponentReference; import org.etsi.mts.tdl.extendedconfigurations.ExtendedGateReference; import org.etsi.mts.tdl.extendedconfigurations.TestConfigurationInstance; import org.etsi.mts.tdl.structuredobjectives.EntityReference; import org.etsi.mts.tdl.structuredobjectives.EventSequence; import org.etsi.mts.tdl.structuredobjectives.StructuredTestObjective; Loading Loading @@ -124,6 +127,9 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { } } else if (context instanceof GateReference) { TestConfiguration configuration = getTestConfiguration((Element) context); if (context instanceof ExtendedGateReference) { configuration = ((ExtendedGateReference) context).getConfiguration().getConfiguration(); } EList<ComponentInstance> components = configuration.getComponentInstance(); IScope scope = Scopes.scopeFor(components); return scope; Loading Loading @@ -247,6 +253,7 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { String n = r.getComponent().getName()+"."+r.getGate().getName(); //TODO: make configurable n = r.getComponent().getName()+"::"+r.getGate().getName(); n = r.getComponent().getName()+getGateReferenceNameSeparator()+r.getGate().getName(); QualifiedName qualifiedName = qualifiedNameConverter.toQualifiedName(n); return qualifiedName; } Loading Loading @@ -297,6 +304,12 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { ) { IScope scope = Scopes.scopeFor(((StructuredDataType)((ParameterBinding)context.eContainer().eContainer()).getParameter().getDataType()).allMembers()); return scope; } else { DataType resolvedDataType = ((DataInstanceUse)context.eContainer()).resolveDataType(); if (resolvedDataType instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)resolvedDataType).allMembers()); return scope; } } } else if (context.eContainer() instanceof FunctionCall) { // if (((FunctionCall)context.eContainer()).getFunction().get instanceof StructuredDataInstance) { Loading Loading @@ -334,8 +347,10 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { IScope scope = Scopes.scopeFor(((StructuredDataType)((FormalParameter) dataElement).getDataType()).allMembers()); return scope; } else if (dataElement instanceof StructuredDataInstance) { if (((StructuredDataInstance) dataElement).getDataType() instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance) dataElement).getDataType()).allMembers()); return scope; } } else if (dataElement instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)dataElement).allMembers()); return scope; Loading @@ -345,6 +360,18 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { if (resolvedDataType instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)resolvedDataType).allMembers()); return scope; } else if (resolvedDataType == null) { // DataType resolvedContextDataType = null; // if (context.eContainer().eContainer() instanceof DataElementUse) { // resolvedContextDataType = ((DataElementUse)context.eContainer().eContainer()).resolveDataType(); // } else if (context.eContainer().eContainer() instanceof DataInstanceUse) { // resolvedContextDataType = ((DataInstanceUse)context.eContainer().eContainer()).resolveDataType(); // } // if (resolvedContextDataType instanceof CollectionDataType) { // DataType itemType = ((CollectionDataType) resolvedContextDataType).getItemType(); // IScope scope = Scopes.scopeFor(((StructuredDataType)itemType).allMembers()); // return scope; // } } } Loading Loading @@ -378,9 +405,23 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { return scope; } } } else { //TODO: handle other scenarios? } else if (targetContext.eContainer() instanceof DataElementUse) { DataElementUse dataElementUse = (DataElementUse)targetContext.eContainer(); DataType resolvedDataType = dataElementUse.resolveDataType(); if (resolvedDataType instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)resolvedDataType).allMembers()); return scope; } else if (resolvedDataType instanceof CollectionDataType) { DataType itemType = ((CollectionDataType)resolvedDataType).getItemType(); if (itemType instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType) itemType).allMembers()); return scope; } } } //TODO: handle other scenarios? } } Loading Loading @@ -417,8 +458,10 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { IScope scope = Scopes.scopeFor(((StructuredDataType)((FormalParameter) dataElement).getDataType()).allMembers()); return scope; } else if (dataElement instanceof StructuredDataInstance) { if (((StructuredDataInstance) dataElement).getDataType() instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance) dataElement).getDataType()).allMembers()); return scope; } } else if (dataElement instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)dataElement).allMembers()); return scope; Loading Loading @@ -488,6 +531,14 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { //return Scopes.scopeFor(dataElement.eContents()); } if (context instanceof ComponentReference && reference.getEType().getInstanceClass() == ComponentInstance.class) { TestConfigurationInstance configuration = ((ComponentReference) context).getConfiguration(); if (configuration.getConfiguration()!=null) { IScope scope = Scopes.scopeFor(configuration.getConfiguration().getComponentInstance()); return scope; } } if (context instanceof Block) { TestDescription testDescription = getTestDescription((Element) context); if (testDescription!=null) { Loading @@ -499,6 +550,10 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { return super.getScope(context, reference); } protected String getGateReferenceNameSeparator() { return "."; } private TestConfiguration getTestConfiguration(Element self) { if (self.eContainer()!=null) { if (!(self.eContainer() instanceof TestConfiguration)) { Loading Loading
plugins/org.etsi.mts.tdl.common/src/org/etsi/mts/tdl/scoping/TDLScopeProvider.java +61 −6 Original line number Diff line number Diff line Loading @@ -68,6 +68,9 @@ import org.etsi.mts.tdl.ValueAssignment; import org.etsi.mts.tdl.Variable; import org.etsi.mts.tdl.VariableUse; import org.etsi.mts.tdl.tdlPackage; import org.etsi.mts.tdl.extendedconfigurations.ComponentReference; import org.etsi.mts.tdl.extendedconfigurations.ExtendedGateReference; import org.etsi.mts.tdl.extendedconfigurations.TestConfigurationInstance; import org.etsi.mts.tdl.structuredobjectives.EntityReference; import org.etsi.mts.tdl.structuredobjectives.EventSequence; import org.etsi.mts.tdl.structuredobjectives.StructuredTestObjective; Loading Loading @@ -124,6 +127,9 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { } } else if (context instanceof GateReference) { TestConfiguration configuration = getTestConfiguration((Element) context); if (context instanceof ExtendedGateReference) { configuration = ((ExtendedGateReference) context).getConfiguration().getConfiguration(); } EList<ComponentInstance> components = configuration.getComponentInstance(); IScope scope = Scopes.scopeFor(components); return scope; Loading Loading @@ -247,6 +253,7 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { String n = r.getComponent().getName()+"."+r.getGate().getName(); //TODO: make configurable n = r.getComponent().getName()+"::"+r.getGate().getName(); n = r.getComponent().getName()+getGateReferenceNameSeparator()+r.getGate().getName(); QualifiedName qualifiedName = qualifiedNameConverter.toQualifiedName(n); return qualifiedName; } Loading Loading @@ -297,6 +304,12 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { ) { IScope scope = Scopes.scopeFor(((StructuredDataType)((ParameterBinding)context.eContainer().eContainer()).getParameter().getDataType()).allMembers()); return scope; } else { DataType resolvedDataType = ((DataInstanceUse)context.eContainer()).resolveDataType(); if (resolvedDataType instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)resolvedDataType).allMembers()); return scope; } } } else if (context.eContainer() instanceof FunctionCall) { // if (((FunctionCall)context.eContainer()).getFunction().get instanceof StructuredDataInstance) { Loading Loading @@ -334,8 +347,10 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { IScope scope = Scopes.scopeFor(((StructuredDataType)((FormalParameter) dataElement).getDataType()).allMembers()); return scope; } else if (dataElement instanceof StructuredDataInstance) { if (((StructuredDataInstance) dataElement).getDataType() instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance) dataElement).getDataType()).allMembers()); return scope; } } else if (dataElement instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)dataElement).allMembers()); return scope; Loading @@ -345,6 +360,18 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { if (resolvedDataType instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)resolvedDataType).allMembers()); return scope; } else if (resolvedDataType == null) { // DataType resolvedContextDataType = null; // if (context.eContainer().eContainer() instanceof DataElementUse) { // resolvedContextDataType = ((DataElementUse)context.eContainer().eContainer()).resolveDataType(); // } else if (context.eContainer().eContainer() instanceof DataInstanceUse) { // resolvedContextDataType = ((DataInstanceUse)context.eContainer().eContainer()).resolveDataType(); // } // if (resolvedContextDataType instanceof CollectionDataType) { // DataType itemType = ((CollectionDataType) resolvedContextDataType).getItemType(); // IScope scope = Scopes.scopeFor(((StructuredDataType)itemType).allMembers()); // return scope; // } } } Loading Loading @@ -378,9 +405,23 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { return scope; } } } else { //TODO: handle other scenarios? } else if (targetContext.eContainer() instanceof DataElementUse) { DataElementUse dataElementUse = (DataElementUse)targetContext.eContainer(); DataType resolvedDataType = dataElementUse.resolveDataType(); if (resolvedDataType instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)resolvedDataType).allMembers()); return scope; } else if (resolvedDataType instanceof CollectionDataType) { DataType itemType = ((CollectionDataType)resolvedDataType).getItemType(); if (itemType instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType) itemType).allMembers()); return scope; } } } //TODO: handle other scenarios? } } Loading Loading @@ -417,8 +458,10 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { IScope scope = Scopes.scopeFor(((StructuredDataType)((FormalParameter) dataElement).getDataType()).allMembers()); return scope; } else if (dataElement instanceof StructuredDataInstance) { if (((StructuredDataInstance) dataElement).getDataType() instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)((StructuredDataInstance) dataElement).getDataType()).allMembers()); return scope; } } else if (dataElement instanceof StructuredDataType) { IScope scope = Scopes.scopeFor(((StructuredDataType)dataElement).allMembers()); return scope; Loading Loading @@ -488,6 +531,14 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { //return Scopes.scopeFor(dataElement.eContents()); } if (context instanceof ComponentReference && reference.getEType().getInstanceClass() == ComponentInstance.class) { TestConfigurationInstance configuration = ((ComponentReference) context).getConfiguration(); if (configuration.getConfiguration()!=null) { IScope scope = Scopes.scopeFor(configuration.getConfiguration().getComponentInstance()); return scope; } } if (context instanceof Block) { TestDescription testDescription = getTestDescription((Element) context); if (testDescription!=null) { Loading @@ -499,6 +550,10 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { return super.getScope(context, reference); } protected String getGateReferenceNameSeparator() { return "."; } private TestConfiguration getTestConfiguration(Element self) { if (self.eContainer()!=null) { if (!(self.eContainer() instanceof TestConfiguration)) { Loading