diff --git a/plugins/org.etsi.mts.tdl.common/src/org/etsi/mts/tdl/scoping/TDLScopeProvider.java b/plugins/org.etsi.mts.tdl.common/src/org/etsi/mts/tdl/scoping/TDLScopeProvider.java index 026dfe27cf0c2d4cb90388a27ef3f751f4aeabf2..c79ff620fd11966e8dbb7976d371d62e97b81efe 100644 --- a/plugins/org.etsi.mts.tdl.common/src/org/etsi/mts/tdl/scoping/TDLScopeProvider.java +++ b/plugins/org.etsi.mts.tdl.common/src/org/etsi/mts/tdl/scoping/TDLScopeProvider.java @@ -495,46 +495,46 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider { } } if (context.eContainer() instanceof DataUse) { - if (((DataUse)context.eContainer()).getReduction().indexOf(context)>0) { - EObject targetContext = ((DataUse)context.eContainer()).getReduction().get(((DataUse)context.eContainer()).getReduction().indexOf(context)-1); - if (((MemberReference)targetContext).getMember()!=null) { - if (((MemberReference)targetContext).getMember().getDataType() instanceof StructuredDataType) { - IScope scope = Scopes.scopeFor(((StructuredDataType)((MemberReference)targetContext).getMember().getDataType()).allMembers()); - return scope; - } - } else if (((MemberReference)targetContext).getCollectionIndex()!=null) { - if (targetContext.eContainer() instanceof DataInstanceUse) { - DataInstanceUse dataInstanceUse = (DataInstanceUse)targetContext.eContainer(); - if (dataInstanceUse.getDataType()!=null) { - //TODO:? - } else if (dataInstanceUse.getDataInstance()!=null) { - //TODO: check type - DataType itemType = ((CollectionDataType)dataInstanceUse.getDataInstance().getDataType()).getItemType(); - if (itemType instanceof StructuredDataType) { - IScope scope = Scopes.scopeFor(((StructuredDataType)itemType).allMembers()); - return scope; - } - } - } 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()); + if (((DataUse)context.eContainer()).getReduction().indexOf(context)>0) { + EObject targetContext = ((DataUse)context.eContainer()).getReduction().get(((DataUse)context.eContainer()).getReduction().indexOf(context)-1); + if (((MemberReference)targetContext).getMember()!=null) { + if (((MemberReference)targetContext).getMember().getDataType() instanceof StructuredDataType) { + IScope scope = Scopes.scopeFor(((StructuredDataType)((MemberReference)targetContext).getMember().getDataType()).allMembers()); return scope; - } else if (resolvedDataType instanceof CollectionDataType) { - DataType itemType = ((CollectionDataType)resolvedDataType).getItemType(); - if (itemType instanceof StructuredDataType) { - IScope scope = Scopes.scopeFor(((StructuredDataType) itemType).allMembers()); + } + } else if (((MemberReference)targetContext).getCollectionIndex()!=null) { + if (targetContext.eContainer() instanceof DataInstanceUse) { + DataInstanceUse dataInstanceUse = (DataInstanceUse)targetContext.eContainer(); + if (dataInstanceUse.getDataType()!=null) { + //TODO:? + } else if (dataInstanceUse.getDataInstance()!=null) { + //TODO: check type + DataType itemType = ((CollectionDataType)dataInstanceUse.getDataInstance().getDataType()).getItemType(); + if (itemType instanceof StructuredDataType) { + IScope scope = Scopes.scopeFor(((StructuredDataType)itemType).allMembers()); + return scope; + } + } + } 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? } - //TODO: handle other scenarios? - - } - } + } } if (context.eContainer() instanceof DataInstanceUse) { if (((DataInstanceUse)context.eContainer()).getDataInstance() instanceof StructuredDataInstance) {