Package com._1c.g5.v8.dt.bm.xtext
Class XtextBmLinkProvider
- java.lang.Object
-
- com._1c.g5.v8.dt.bm.xtext.XtextBmLinkProvider
-
- All Implemented Interfaces:
IBmExternalUriResolver
,IBmProjectAwareExternalUriResolver
- Direct Known Subclasses:
BslBmLinkProvider
public abstract class XtextBmLinkProvider extends Object implements IBmProjectAwareExternalUriResolver
SpecialIBmLinkProvider
for xtext resources
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XtextBmLinkProvider.UriResourceContainerCache
Special container for link provider resources.
-
Field Summary
Fields Modifier and Type Field Description protected String
extension
protected ReentrantReadWriteLock
readWriteLock
protected BmAwareResourceSetProvider
resourceSetProvider
-
Constructor Summary
Constructors Constructor Description XtextBmLinkProvider()
Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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 notvoid
clear()
Clearing all containing resourcesprotected org.eclipse.emf.ecore.resource.Resource
createResource(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.common.util.URI uriTrim)
Creates resource by uriprotected abstract XtextBmLinkProvider.UriResourceContainerCache
createUriResourceContainerCache()
Creates specialXtextBmLinkProvider.UriResourceContainerCache
for caching link provider resourcesprotected abstract boolean
fileExist(org.eclipse.emf.common.util.URI uriTrim)
Checks that file for reading content of the resource existorg.eclipse.emf.ecore.EObject
getObject(org.eclipse.emf.common.util.URI uri)
Resolves the specified URI.org.eclipse.core.resources.IProject
getProject()
Gets specified project.protected org.eclipse.core.resources.IProject
getProject(org.eclipse.emf.common.util.URI uri)
Gets project byURI
.org.eclipse.emf.ecore.resource.Resource
getResource(org.eclipse.emf.common.util.URI uri)
Ask link providers to obtain resource matched with specified URI.protected void
initResource(org.eclipse.emf.ecore.resource.Resource newResource)
Initialize resourceboolean
isPassthrough()
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.boolean
isResourceLoaded(org.eclipse.emf.common.util.URI uri)
Checks that resource withuri
was loaded earlierprotected abstract boolean
needCacheResource(org.eclipse.emf.common.util.URI uri)
Checks that resource creating by thisfile
need to be cachedvoid
remove(org.eclipse.emf.common.util.URI uri)
Remove caching resource by urivoid
setProject(org.eclipse.core.resources.IProject project)
Sets the specified project.boolean
supports(org.eclipse.emf.common.util.URI uri)
Checks if the specified URI is supported.protected String
toResourceFileName(org.eclipse.emf.common.util.URI uriTrim)
Converts uri to valid path to the file of resoucevoid
update(org.eclipse.emf.ecore.resource.Resource resource)
Updates caching resource
-
-
-
Field Detail
-
readWriteLock
protected ReentrantReadWriteLock readWriteLock
-
extension
@Inject protected String extension
-
resourceSetProvider
@Inject protected BmAwareResourceSetProvider resourceSetProvider
-
-
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 benull
-
update
public void update(org.eclipse.emf.ecore.resource.Resource resource)
Updates caching resource- Parameters:
resource
- new resource for caching, can't benull
-
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 interfaceIBmExternalUriResolver
- Parameters:
uri
- The resource URI. May not benull
- 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 interfaceIBmExternalUriResolver
- 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 withuri
was loaded earlier- Parameters:
uri
- checking resource uri, can't benull
- Returns:
true
if resource was loadef earlier,false
otherwise
-
setProject
public void setProject(org.eclipse.core.resources.IProject project)
Description copied from interface:IBmProjectAwareExternalUriResolver
Sets the specified project. The project should be set when implementation of this interface was created.- Specified by:
setProject
in interfaceIBmProjectAwareExternalUriResolver
- Parameters:
project
- The project. May not benull
.
-
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 interfaceIBmExternalUriResolver
- Parameters:
uri
- The URI to run the check against. May not benull
.- Returns:
true
if the URI is supported by this resolver, otherwisefalse
.
-
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 interfaceIBmExternalUriResolver
- Parameters:
uri
- The URI. May not benull
.- Returns:
- the object identified by the specified URI if found, otherwise
null
.
-
getProject
public org.eclipse.core.resources.IProject getProject()
Description copied from interface:IBmProjectAwareExternalUriResolver
Gets specified project. Returning project should set in methodIBmProjectAwareExternalUriResolver.setProject(IProject)
- Specified by:
getProject
in interfaceIBmProjectAwareExternalUriResolver
- Returns:
- specified project, never
null
-
getProject
protected org.eclipse.core.resources.IProject getProject(org.eclipse.emf.common.util.URI uri)
Gets project byURI
. SeeIResourceLookup.getProject(URI)
- Parameters:
uri
- the object URI, cannot benull
- 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 benull
loadedResource
- loaded resource, can't benull
- Returns:
- new loaded resource if needed or
loadedResouce
, nevernull
-
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 benull
uriTrim
- uri of the resource, can't benull
- 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 benull
- 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 benull
-
createUriResourceContainerCache
protected abstract XtextBmLinkProvider.UriResourceContainerCache createUriResourceContainerCache()
Creates specialXtextBmLinkProvider.UriResourceContainerCache
for caching link provider resources- Returns:
- special
XtextBmLinkProvider.UriResourceContainerCache
for caching link provider resources, nevernull
-
needCacheResource
protected abstract boolean needCacheResource(org.eclipse.emf.common.util.URI uri)
Checks that resource creating by thisfile
need to be cached- Parameters:
file
-IFile
corresponding to the creating link provider resources, can't benull
- 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 benull
- Returns:
- valid path to the file of resouce, never
null
-
-