/*
* generated by Xtext
*/
package org.csu.idl.xtext.scoping;
import org.csu.idl.idlmm.Container;
import org.csu.idl.idlmm.ForwardDef;
import org.csu.idl.idlmm.InterfaceDef;
import org.csu.idl.idlmm.TranslationUnit;
import org.csu.idl.idlmm.UnionDef;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
/**
* This class contains custom scoping description.
*
* see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping
* on how and when to use it
*
*/
public class IDLScopeProvider extends AbstractDeclarativeScopeProvider {
public IScope scope_UnionDef(UnionDef context, EReference reference) throws Exception {
EObject ct = context.eContainer();
if (ct instanceof Container)
return IDLScopingHelper.getScope((Container) ct, reference.getEReferenceType());
else if (ct instanceof TranslationUnit)
return IDLScopingHelper.getScope((TranslationUnit) ct, reference.getEReferenceType());
return IScope.NULLSCOPE;
}
public IScope scope_InterfaceDef(InterfaceDef context, EReference reference) throws Exception {
EObject ct = context.eContainer();
if (ct instanceof Container)
return IDLScopingHelper.getScope((Container) ct, reference.getEReferenceType());
else if (ct instanceof TranslationUnit)
return IDLScopingHelper.getScope((TranslationUnit) ct, reference.getEReferenceType());
return IScope.NULLSCOPE;
}
public IScope scope_InterfaceDef(ForwardDef context, EReference reference) throws Exception {
EObject ct = context.eContainer();
if (ct instanceof Container)
return IDLScopingHelper.getScope((Container) ct, reference.getEReferenceType());
else if (ct instanceof TranslationUnit)
return IDLScopingHelper.getScope((TranslationUnit) ct, reference.getEReferenceType());
return IScope.NULLSCOPE;
}
public IScope scope_TypedefDef(Container context, EReference reference) throws Exception {
return IDLScopingHelper.getScope(context, reference.getEReferenceType());
}
public IScope scope_TypedefDef(TranslationUnit context, EReference reference) throws Exception {
return IDLScopingHelper.getScope(context, reference.getEReferenceType());
}
public IScope scope_ExceptionDef(Container context, EReference reference) throws Exception {
return IDLScopingHelper.getScope(context, reference.getEReferenceType());
}
public IScope scope_Constant(Container context, EReference reference) throws Exception {
return IDLScopingHelper.getScope(context, reference.getEReferenceType());
}
public IScope scope_Constant(TranslationUnit context, EReference reference) throws Exception {
IScope sc = IDLScopingHelper.getScope(context,
reference.getEReferenceType());
return sc;
}
}