Class ImportedNamespaceAwareLocalScopeProvider

  • All Implemented Interfaces:
    IScopeProvider

    public class ImportedNamespaceAwareLocalScopeProvider
    extends AbstractGlobalScopeDelegatingScopeProvider
    A local scope provider that understands namespace imports. It scans model elements for an EAttribute importedNamespace. The value of this attribute is interpreted as qualified name to be imported. Wildcards are supported (see getWildCard() 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.
    • Method Detail

      • getScope

        public IScope getScope​(org.eclipse.emf.ecore.EObject context,
                               org.eclipse.emf.ecore.EReference reference)
        Description copied from interface: IScopeProvider
        Returns 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 given EReference.
        reference - the reference for which to get the scope.
        Returns:
        IScope representing the innermost IScope for the passed context and reference. Note for implementors: The result may not be null. Return IScope.NULLSCOPE instead.
      • 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 new ImportNormalizer for the given namespace.
        Parameters:
        namespace - the namespace.
        ignoreCase - true if the resolver should be case insensitive.
        Returns:
        a new ImportNormalizer or null if 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)
      • 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()