Commit 35b040ec authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ partial scoping fix for reduction of collection items

parent 4ae1c42d
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import org.etsi.mts.tdl.Connection;
import org.etsi.mts.tdl.DataElementMapping;
import org.etsi.mts.tdl.DataInstanceUse;
import org.etsi.mts.tdl.DataType;
import org.etsi.mts.tdl.CollectionDataType;
import org.etsi.mts.tdl.CollectionDataInstance;
import org.etsi.mts.tdl.DataUse;
import org.etsi.mts.tdl.Element;
import org.etsi.mts.tdl.ElementImport;
@@ -293,6 +295,23 @@ public class TDLScopeProvider extends AbstractDeclarativeScopeProvider {
							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 {
							//TODO: handle other scenarios?
						}
						
					}
				} 
				if (context.eContainer() instanceof DataInstanceUse) {