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
- Direct Known Subclasses:
BslBmLinkProvider
Special
IBmLinkProvider for xtext resources-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.eclipse.emf.ecore.resource.ResourcecheckResourceInResourceSet(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 notvoidcleanUp()Performs any pending maintenance operations needed by the cache.voidclear()Clearing all containing resourcesprotected com.google.common.cache.Cache<org.eclipse.emf.common.util.URI,org.eclipse.emf.ecore.resource.Resource> Creates specialCachefor caching link provider resources, with eviction.protected org.eclipse.emf.ecore.resource.ResourcecreateResource(org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.common.util.URI uriTrim) Creates resource by uriprotected abstract booleanfileExist(org.eclipse.emf.common.util.URI uriTrim) Checks that file for reading content of the resource existprotected intgetCacheEntryWeight(org.eclipse.emf.common.util.URI uri, org.eclipse.emf.ecore.resource.Resource resource) Calculates the cache entry weight.org.eclipse.emf.ecore.EObjectgetObject(org.eclipse.emf.common.util.URI uri) Resolves the specified URI.protected org.eclipse.core.resources.IProjectgetProject(org.eclipse.emf.common.util.URI uri) Gets project byURI.org.eclipse.emf.ecore.resource.ResourcegetResource(org.eclipse.emf.common.util.URI uri) Ask link providers to obtain resource matched with specified URI.protected voidinitResource(org.eclipse.emf.ecore.resource.Resource newResource) Initialize resourcebooleanDesignates that resources being returned by this resolver remain as-is (with original resource set and so on) and not being copied to the session.booleanisResourceLoaded(org.eclipse.emf.common.util.URI uri) Checks that resource withuriwas loaded earlierprotected org.eclipse.emf.ecore.resource.ResourceloadResource(org.eclipse.emf.common.util.URI uriTrim) Load resource by the URI.protected abstract booleanneedCacheResource(org.eclipse.emf.common.util.URI uri) Checks that resource creating by thisfileneed to be cachedprotected voidonRemoval(com.google.common.cache.RemovalNotification<org.eclipse.emf.common.util.URI, org.eclipse.emf.ecore.resource.Resource> notification) Event of the cache when the entry has removed.voidremove(org.eclipse.emf.common.util.URI uri) Remove caching resource by urivoidReset caches of a resolver if applicablebooleansupports(org.eclipse.emf.common.util.URI uri) Checks if the specified URI is supported.protected StringtoResourceFileName(org.eclipse.emf.common.util.URI uriTrim) Converts uri to valid path to the file of resoucevoidupdate(org.eclipse.emf.ecore.resource.Resource resource) Updates caching resource
-
Field Details
-
extension
-
resourceSetProvider
-
-
Constructor Details
-
XtextBmLinkProvider
public XtextBmLinkProvider()Constructor
-
-
Method Details
-
clear
public void clear()Clearing all containing resources -
cleanUp
public void cleanUp()Performs any pending maintenance operations needed by the cache. Exactly which activities are performed -- if any -- is implementation-dependent. -
remove
public void remove(org.eclipse.emf.common.util.URI uri) Remove caching resource by uri- Parameters:
uri-URIof 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:IBmExternalUriResolverAsk link providers to obtain resource matched with specified URI. Used to provider resources for system types.- Specified by:
getResourcein 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:IBmExternalUriResolverDesignates 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:
isPassthroughin interfaceIBmExternalUriResolver- Returns:
trueif this resolver works in the passthrough mode;falseotherwise.
-
isResourceLoaded
public boolean isResourceLoaded(org.eclipse.emf.common.util.URI uri) Checks that resource withuriwas loaded earlier- Parameters:
uri- checking resource uri, can't benull- Returns:
trueif resource was loaded earlier,falseotherwise
-
supports
public boolean supports(org.eclipse.emf.common.util.URI uri) Description copied from interface:IBmExternalUriResolverChecks if the specified URI is supported.- Specified by:
supportsin interfaceIBmExternalUriResolver- Parameters:
uri- The URI to run the check against. May not benull.- Returns:
trueif 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:IBmExternalUriResolverResolves the specified URI.- Specified by:
getObjectin interfaceIBmExternalUriResolver- Parameters:
uri- The URI. May not benull.- Returns:
- the object identified by the specified URI if found, otherwise
null.
-
resetCaches
public void resetCaches()Description copied from interface:IBmExternalUriResolverReset caches of a resolver if applicable- Specified by:
resetCachesin interfaceIBmExternalUriResolver
-
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 benullloadedResource- loaded resource, can't benull- Returns:
- new loaded resource if needed or
loadedResouce, nevernull
-
loadResource
protected org.eclipse.emf.ecore.resource.Resource loadResource(org.eclipse.emf.common.util.URI uriTrim) Load resource by the URI.- Parameters:
uriTrim- the uri trimmed of fragment, cannot benull.- Returns:
- the resource loaded resource
-
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-ResourceSetfor creating resource, can't benulluriTrim- 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:
trueif file for reading content of the resource exist,falseotherwise
-
initResource
protected void initResource(org.eclipse.emf.ecore.resource.Resource newResource) Initialize resource- Parameters:
newResource- initializing resource, can't benull
-
createCache
protected com.google.common.cache.Cache<org.eclipse.emf.common.util.URI,org.eclipse.emf.ecore.resource.Resource> createCache()Creates specialCachefor caching link provider resources, with eviction. Default configuration uses eviction: Max cache weight limit, 15 minutes expiration after access and entry weight calculation.- Returns:
- special
Cachefor caching link provider resources, nevernull
-
getCacheEntryWeight
protected int getCacheEntryWeight(org.eclipse.emf.common.util.URI uri, org.eclipse.emf.ecore.resource.Resource resource) Calculates the cache entry weight.- Parameters:
uri- the URI of resource, cannot benull.resource- the loaded resource, cannot benull.- Returns:
- the cache entry weight, When the weight of an entry is zero it will not be considered for size-based eviction(though it still may be evicted by other means).
- See Also:
-
CacheBuilder.weigher(com.google.common.cache.Weigher)
-
needCacheResource
protected abstract boolean needCacheResource(org.eclipse.emf.common.util.URI uri) Checks that resource creating by thisfileneed to be cached- Parameters:
file-IFilecorresponding to the creating link provider resources, can't benull- Returns:
trueif resource should be cached,falseotherwise
-
toResourceFileName
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
-
onRemoval
protected void onRemoval(com.google.common.cache.RemovalNotification<org.eclipse.emf.common.util.URI, org.eclipse.emf.ecore.resource.Resource> notification) Event of the cache when the entry has removed.- Parameters:
notification- the notification of removal, cannot benull.
-