Class XtextBmLinkProvider

    • Constructor Detail

      • XtextBmLinkProvider

        public XtextBmLinkProvider()
        Constructor
    • Method Detail

      • clear

        public void clear()
        Clearing all containing resources
      • remove

        public void remove​(org.eclipse.emf.common.util.URI uri)
        Remove caching resource by uri
        Parameters:
        uri - URI of the removing resource, can't be null
      • update

        public void update​(org.eclipse.emf.ecore.resource.Resource resource)
        Updates caching resource
        Parameters:
        resource - new resource for caching, can't be null
      • getResource

        public org.eclipse.emf.ecore.resource.Resource getResource​(org.eclipse.emf.common.util.URI uri)
        Description copied from interface: IBmExternalUriResolver
        Ask link providers to obtain resource matched with specified URI. Used to provider resources for system types.
        Specified by:
        getResource in interface IBmExternalUriResolver
        Parameters:
        uri - The resource URI. May not be null
        Returns:
        the loaded resource if found, otherwise null.
      • isPassthrough

        public boolean isPassthrough()
        Description copied from interface: IBmExternalUriResolver
        Designates that resources being returned by this resolver remain as-is (with original resource set and so on) and not being copied to the session. This approach can be used by complex resource providers requiring specific support from original resource sets (like Xtext).
        BM could use such link providers for seamless URI resolution to external resources that shouldn't be cached out in the BM resource set.
        Specified by:
        isPassthrough in interface IBmExternalUriResolver
        Returns:
        true if this resolver works in the passthrough mode; false otherwise.
      • isResourceLoaded

        public boolean isResourceLoaded​(org.eclipse.emf.common.util.URI uri)
        Checks that resource with uri was loaded earlier
        Parameters:
        uri - checking resource uri, can't be null
        Returns:
        true if resource was loadef earlier, false otherwise
      • supports

        public boolean supports​(org.eclipse.emf.common.util.URI uri)
        Description copied from interface: IBmExternalUriResolver
        Checks if the specified URI is supported.
        Specified by:
        supports in interface IBmExternalUriResolver
        Parameters:
        uri - The URI to run the check against. May not be null.
        Returns:
        true if the URI is supported by this resolver, otherwise false.
      • getObject

        public org.eclipse.emf.ecore.EObject getObject​(org.eclipse.emf.common.util.URI uri)
        Description copied from interface: IBmExternalUriResolver
        Resolves the specified URI.
        Specified by:
        getObject in interface IBmExternalUriResolver
        Parameters:
        uri - The URI. May not be null.
        Returns:
        the object identified by the specified URI if found, otherwise null.
      • getProject

        protected org.eclipse.core.resources.IProject getProject​(org.eclipse.emf.common.util.URI uri)
        Gets project by URI. See IResourceLookup.getProject(URI)
        Parameters:
        uri - the object URI, cannot be null
        Returns:
        the project which contains object with provided URI or null if object is out of any project
      • checkResourceInResourceSet

        protected org.eclipse.emf.ecore.resource.Resource checkResourceInResourceSet​(org.eclipse.emf.common.util.URI uri,
                                                                                     org.eclipse.emf.ecore.resource.Resource loadedResource)
        Additional checking for resource - is it contained in resource set or not
        Parameters:
        uri - uri of the checking resource, can't be null
        loadedResource - loaded resource, can't be null
        Returns:
        new loaded resource if needed or loadedResouce, never null
      • createResource

        protected org.eclipse.emf.ecore.resource.Resource createResource​(org.eclipse.emf.ecore.resource.ResourceSet resourceSet,
                                                                         org.eclipse.emf.common.util.URI uriTrim)
        Creates resource by uri
        Parameters:
        resourceSet - ResourceSet for creating resource, can't be null
        uriTrim - uri of the resource, can't be null
        Returns:
        creating resource, never null
      • fileExist

        protected abstract boolean fileExist​(org.eclipse.emf.common.util.URI uriTrim)
        Checks that file for reading content of the resource exist
        Parameters:
        uriTrim - uri of the reading resource, can't be null
        Returns:
        true if file for reading content of the resource exist, false otherwise
      • initResource

        protected void initResource​(org.eclipse.emf.ecore.resource.Resource newResource)
        Initialize resource
        Parameters:
        newResource - initializing resource, can't be null
      • needCacheResource

        protected abstract boolean needCacheResource​(org.eclipse.emf.common.util.URI uri)
        Checks that resource creating by this file need to be cached
        Parameters:
        file - IFile corresponding to the creating link provider resources, can't be null
        Returns:
        true if resource should be cached, false otherwise
      • toResourceFileName

        protected String toResourceFileName​(org.eclipse.emf.common.util.URI uriTrim)
        Converts uri to valid path to the file of resouce
        Parameters:
        uriTrim - uri of the resource, can't be null
        Returns:
        valid path to the file of resouce, never null