diff options
Diffstat (limited to 'rba.tool.editor/src/rba/tool/editor/scoping/internal/RBAModelMemberOperationScopes.xtend')
-rw-r--r-- | rba.tool.editor/src/rba/tool/editor/scoping/internal/RBAModelMemberOperationScopes.xtend | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/rba.tool.editor/src/rba/tool/editor/scoping/internal/RBAModelMemberOperationScopes.xtend b/rba.tool.editor/src/rba/tool/editor/scoping/internal/RBAModelMemberOperationScopes.xtend new file mode 100644 index 0000000..da833ec --- /dev/null +++ b/rba.tool.editor/src/rba/tool/editor/scoping/internal/RBAModelMemberOperationScopes.xtend @@ -0,0 +1,27 @@ +package rba.tool.editor.scoping.internal + +import com.google.inject.Inject +import org.eclipse.emf.ecore.EObject +import org.eclipse.xtext.scoping.IScope +import org.eclipse.xtext.scoping.impl.SimpleScope +import rba.tool.editor.scoping.IExpressionScope + +class RBAModelMemberOperationScopes implements IMemberFeatureScopes { + + private RBAModelMemberOperationRegistry operationRegistry; + + @Inject + new(RBAModelMemberOperationRegistry operationRegistry) { + this.operationRegistry = operationRegistry; + } + + override createFeatureScope(EObject model) { + return createFeatureScope(model, IExpressionScope.Anchor.UNKNOWN, IScope.NULLSCOPE); + } + + override createFeatureScope(EObject model, IExpressionScope.Anchor anchor, IScope outer) { + val descriptions = operationRegistry.getOperations(model, anchor); + return new SimpleScope(outer, descriptions ?: newHashSet()); + } + +} |