public class ResourceScopeProviderRegistry
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static ResourceScopeProviderRegistry |
INSTANCE
The singleton instance of this registry.
|
| Modifier and Type | Method and Description |
|---|---|
IResourceScopeProvider |
getDefaultResourceScopeProvider()
Returns the default instance of
resource scope provider. |
java.util.Collection<IMetaModelDescriptor> |
getMetaModelDescriptorsFor(IResourceScopeProvider resourceScopeProvider)
Retrieves all the
meta model descriptors registering the provided instance of
resource scope provider. |
IResourceScopeProvider |
getResourceScopeProvider(IMetaModelDescriptor mmDescriptor)
Returns the
resource scope provider registered for the provided
meta model descriptor. |
boolean |
hasApplicableFileExtension(org.eclipse.core.resources.IFile file)
Tests if the given
file's extension corresponds to a file type which is subject to some
resource scope provider. |
boolean |
isNotInAnyScope(org.eclipse.core.resources.IFile file)
Tests if given
file does not belong to any resource scope. |
public static ResourceScopeProviderRegistry INSTANCE
public java.util.Collection<IMetaModelDescriptor> getMetaModelDescriptorsFor(IResourceScopeProvider resourceScopeProvider)
meta model descriptors registering the provided instance of
resource scope provider.resourceScopeProvider - The resource scope provider used to investigate.meta model descriptors the resource scope
provider is registered for.public IResourceScopeProvider getDefaultResourceScopeProvider()
resource scope provider.resource scope provider.public boolean isNotInAnyScope(org.eclipse.core.resources.IFile file)
file does not belong to any resource scope. This can be the
case if given file is an obvious non-model file (e.g., a *.txt file), a model file based on a
metamodel that is not described by a metamodel descriptor, or a model file which is
out of scope.
This method is guaranteed to have a very little performance overhead. It can be used by clients to optimize the
retrieval of the resource scopes for large amounts of model and/or non-model files (e.g., after new files have been imported into the workspace). Clients therefore should call
this method of hasApplicableFileExtension(IFile) prior to actually retrieving the resource scope for a file using getResourceScopeProvider(IMetaModelDescriptor) and
IResourceScopeProvider.getScope(org.eclipse.core.resources.IResource). This makes sure that irrelevant
files get filtered out in an efficient way and useless but potentially costly attempts of
retrieving the resource scope for such files are avoided.
file - The file to be investigated.true if given file does not belong to any resource
scope, false otherwise.hasApplicableFileExtension(IFile)public boolean hasApplicableFileExtension(org.eclipse.core.resources.IFile file)
file's extension corresponds to a file type which is subject to some
resource scope provider. This is automatically the case if given file is a model file based on a metamodel that is described by a metamodel
descriptor. The applicable resource scope provider for such model files is either
one that has been specifically contributed to the underlying metamodel descriptor
via the org.eclipse.sphinx.emf.resourceScopeProviders extension point or a
default resource scope provider.
This method is guaranteed to have a very little performance overhead. It can be used by clients to optimize the
retrieval of the resource scopes for large amounts of model and/or non-model files (e.g., after new files have been imported into the workspace). Clients therefore should call
this method or isNotInAnyScope(IFile) prior to actually retrieving the resource
scope for a file using getResourceScopeProvider(IMetaModelDescriptor) and
IResourceScopeProvider.getScope(org.eclipse.core.resources.IResource). This makes sure that irrelevant
files get filtered out in an efficient way and useless but potentially costly attempts of
retrieving the resource scope for such files are avoided.
file - The file to be investigated.true if some resource scope provider is applicable to
files having the extension of the given file, false otherwise.isNotInAnyScope(IFile)public IResourceScopeProvider getResourceScopeProvider(IMetaModelDescriptor mmDescriptor)
resource scope provider registered for the provided
meta model descriptor.mmDescriptor - The meta model descriptor use to investigate.resource scope provider registered for the provided
meta model descriptor or null if none has been registered.