Package org.eclipse.xtext.scoping.impl
Class ImportedNamespaceAwareLocalScopeProvider
- java.lang.Object
-
- org.eclipse.xtext.scoping.impl.AbstractScopeProvider
-
- org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider
-
- org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider
-
- All Implemented Interfaces:
IScopeProvider
public class ImportedNamespaceAwareLocalScopeProvider extends AbstractGlobalScopeDelegatingScopeProvider
A local scope provider that understands namespace imports. It scans model elements for an EAttributeimportedNamespace. The value of this attribute is interpreted as qualified name to be imported. Wildcards are supported (seegetWildCard()for details). Imports are valid for all elements in the same container and their children. See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping for details.
-
-
Constructor Summary
Constructors Constructor Description ImportedNamespaceAwareLocalScopeProvider()ImportedNamespaceAwareLocalScopeProvider(IGlobalScopeProvider globalScopeProvider, IQualifiedNameProvider qualifiedNameProvider, IQualifiedNameConverter qualifiedNameConverter, ICaseInsensitivityHelper caseInsensitivityHelper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ImportNormalizercreateImportedNamespaceResolver(java.lang.String namespace, boolean ignoreCase)Create a newImportNormalizerfor the given namespace.protected ImportScopecreateImportScope(IScope parent, java.util.List<ImportNormalizer> namespaceResolvers, ISelectable importFrom, org.eclipse.emf.ecore.EClass type, boolean ignoreCase)protected ImportNormalizerdoCreateImportNormalizer(QualifiedName importedNamespace, boolean wildcard, boolean ignoreCase)protected ISelectablegetAllDescriptions(org.eclipse.emf.ecore.resource.Resource resource)protected java.util.List<ImportNormalizer>getImplicitImports(boolean ignoreCase)protected java.lang.StringgetImportedNamespace(org.eclipse.emf.ecore.EObject object)protected java.util.List<ImportNormalizer>getImportedNamespaceResolvers(org.eclipse.emf.ecore.EObject context, boolean ignoreCase)protected java.lang.ObjectgetKey(org.eclipse.emf.common.notify.Notifier context, org.eclipse.emf.ecore.EReference reference)protected IScopegetLocalElementsScope(IScope parent, org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)IQualifiedNameConvertergetQualifiedNameConverter()protected QualifiedNamegetQualifiedNameOfLocalElement(org.eclipse.emf.ecore.EObject context)IQualifiedNameProvidergetQualifiedNameProvider()protected IScopegetResourceScope(org.eclipse.emf.ecore.resource.Resource res, org.eclipse.emf.ecore.EReference reference)protected IScopegetResourceScope(IScope parent, org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)IScopegetScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)Returns a scope for the given context.java.lang.StringgetWildCard()protected ISelectableinternalGetAllDescriptions(org.eclipse.emf.ecore.resource.Resource resource)protected java.util.List<ImportNormalizer>internalGetImportedNamespaceResolvers(org.eclipse.emf.ecore.EObject context, boolean ignoreCase)protected booleanisRelativeImport()-
Methods inherited from class org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider
getGlobalScope, getGlobalScope, isIgnoreCase, setWrapper, wrap
-
-
-
-
Constructor Detail
-
ImportedNamespaceAwareLocalScopeProvider
@Inject public ImportedNamespaceAwareLocalScopeProvider()
-
ImportedNamespaceAwareLocalScopeProvider
public ImportedNamespaceAwareLocalScopeProvider(IGlobalScopeProvider globalScopeProvider, IQualifiedNameProvider qualifiedNameProvider, IQualifiedNameConverter qualifiedNameConverter, ICaseInsensitivityHelper caseInsensitivityHelper)
-
-
Method Detail
-
getQualifiedNameProvider
public IQualifiedNameProvider getQualifiedNameProvider()
-
getQualifiedNameConverter
public IQualifiedNameConverter getQualifiedNameConverter()
- Since:
- 2.10
-
getScope
public IScope getScope(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)
Description copied from interface:IScopeProviderReturns a scope for the given context. The scope provides access to the compatible visible EObjects for a given reference.- Parameters:
context- the element from which an element shall be referenced. It doesn't need to be the element containing the reference, it is just used to find the most inner scope for givenEReference.reference- the reference for which to get the scope.- Returns:
IScoperepresenting the innermostIScopefor the passed context and reference. Note for implementors: The result may not benull. ReturnIScope.NULLSCOPEinstead.
-
getResourceScope
protected IScope getResourceScope(org.eclipse.emf.ecore.resource.Resource res, org.eclipse.emf.ecore.EReference reference)
-
getImplicitImports
protected java.util.List<ImportNormalizer> getImplicitImports(boolean ignoreCase)
-
getResourceScope
protected IScope getResourceScope(IScope parent, org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)
-
getKey
protected java.lang.Object getKey(org.eclipse.emf.common.notify.Notifier context, org.eclipse.emf.ecore.EReference reference)
-
getImportedNamespaceResolvers
protected java.util.List<ImportNormalizer> getImportedNamespaceResolvers(org.eclipse.emf.ecore.EObject context, boolean ignoreCase)
-
internalGetImportedNamespaceResolvers
protected java.util.List<ImportNormalizer> internalGetImportedNamespaceResolvers(org.eclipse.emf.ecore.EObject context, boolean ignoreCase)
-
getImportedNamespace
protected java.lang.String getImportedNamespace(org.eclipse.emf.ecore.EObject object)
- Since:
- 2.4
-
createImportedNamespaceResolver
protected ImportNormalizer createImportedNamespaceResolver(java.lang.String namespace, boolean ignoreCase)
Create a newImportNormalizerfor the given namespace.- Parameters:
namespace- the namespace.ignoreCase-trueif the resolver should be case insensitive.- Returns:
- a new
ImportNormalizerornullif the namespace cannot be converted to a valid qualified name.
-
doCreateImportNormalizer
protected ImportNormalizer doCreateImportNormalizer(QualifiedName importedNamespace, boolean wildcard, boolean ignoreCase)
- Since:
- 2.4
-
getLocalElementsScope
protected IScope getLocalElementsScope(IScope parent, org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EReference reference)
-
createImportScope
protected ImportScope createImportScope(IScope parent, java.util.List<ImportNormalizer> namespaceResolvers, ISelectable importFrom, org.eclipse.emf.ecore.EClass type, boolean ignoreCase)
-
getQualifiedNameOfLocalElement
protected QualifiedName getQualifiedNameOfLocalElement(org.eclipse.emf.ecore.EObject context)
-
isRelativeImport
protected boolean isRelativeImport()
-
getAllDescriptions
protected ISelectable getAllDescriptions(org.eclipse.emf.ecore.resource.Resource resource)
-
internalGetAllDescriptions
protected ISelectable internalGetAllDescriptions(org.eclipse.emf.ecore.resource.Resource resource)
-
getWildCard
public java.lang.String getWildCard()
-
-