| /* |
| * generated by Xtext 2.11.0 |
| */ |
| package org.eclipse.osbp.xtext.action.scoping |
| |
| import org.eclipse.emf.ecore.EObject |
| import org.eclipse.emf.ecore.EReference |
| import org.eclipse.osbp.xtext.action.ActionDSLPackage |
| import org.eclipse.osbp.xtext.action.ActionFunction |
| import org.eclipse.osbp.xtext.functionlibrarydsl.FunctionLibraryActionGroup |
| import org.eclipse.xtext.scoping.Scopes |
| |
| /** |
| * This class contains custom scoping description. |
| * |
| * See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping |
| * on how and when to use it. |
| */ |
| class ActionDSLScopeProvider extends AbstractActionDSLScopeProvider { |
| |
| override getScope(EObject context, EReference reference) { |
| if (reference == ActionDSLPackage.Literals.ACTION_FUNCTION__CAN_EXECUTE) { |
| return getScope_ActionFunctionCanExecute(context as ActionFunction, reference) |
| } else if (reference == ActionDSLPackage.Literals.ACTION_FUNCTION__EXECUTE_IMMEDIATE) { |
| return getScope_ActionFunctionExecuteImmediate(context as ActionFunction, reference) |
| } else if (reference == ActionDSLPackage.Literals.ACTION_FUNCTION__EXECUTE_LATER) { |
| return getScope_ActionFunctionExecuteLater(context as ActionFunction, reference) |
| } |
| return super.getScope(context, reference) |
| } |
| |
| def getScope_ActionFunctionCanExecute(ActionFunction context, EReference reference) { |
| var result = <EObject>newArrayList |
| for (can : (context.actionGroup as FunctionLibraryActionGroup).canExecutes) { |
| result.add(can) |
| } |
| return Scopes::scopeFor(result) |
| } |
| |
| def getScope_ActionFunctionExecuteImmediate(ActionFunction context, EReference reference) { |
| var result = <EObject>newArrayList |
| for (immediate : (context.actionGroup as FunctionLibraryActionGroup).executes) { |
| result.add(immediate) |
| } |
| return Scopes::scopeFor(result) |
| } |
| |
| def getScope_ActionFunctionExecuteLater(ActionFunction context, EReference reference) { |
| var result = <EObject>newArrayList |
| for (later : (context.actionGroup as FunctionLibraryActionGroup).executes) { |
| result.add(later) |
| } |
| return Scopes::scopeFor(result) |
| } |
| } |