public abstract class ModelProvider extends PlatformObject
ResourceMapping
objects that are part of the same model.
This class may be subclassed by clients.
ResourceMapping
Modifier and Type | Field and Description |
---|---|
static String |
RESOURCE_MODEL_PROVIDER_ID
The model provider id of the Resources model.
|
Constructor and Description |
---|
ModelProvider() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
IModelProviderDescriptor |
getDescriptor()
Return the descriptor of this model provider.
|
String |
getId()
Returns the unique identifier of this model provider.
|
ResourceMapping[] |
getMappings(IResource[] resources,
ResourceMappingContext context,
IProgressMonitor monitor)
Return the set of mappings that cover the given resources.
|
ResourceMapping[] |
getMappings(IResource resource,
ResourceMappingContext context,
IProgressMonitor monitor)
Return the resource mappings that cover the given resource.
|
ResourceMapping[] |
getMappings(ResourceTraversal[] traversals,
ResourceMappingContext context,
IProgressMonitor monitor)
Return the set of mappings that overlap with the given resource traversals.
|
static IModelProviderDescriptor |
getModelProviderDescriptor(String id)
Return the descriptor for the model provider of the given id
or
null if the provider has not been registered. |
static IModelProviderDescriptor[] |
getModelProviderDescriptors()
Return the descriptors for all model providers that are registered.
|
ResourceTraversal[] |
getTraversals(ResourceMapping[] mappings,
ResourceMappingContext context,
IProgressMonitor monitor)
Return a set of traversals that cover the given resource mappings.
|
int |
hashCode() |
void |
init(IModelProviderDescriptor desc)
This method is called by the model provider framework when the model
provider is instantiated.
|
protected void |
initialize()
Initialization method that is called after the descriptor
of this provider is set.
|
IStatus |
validateChange(IResourceDelta delta,
IProgressMonitor monitor)
Validate the proposed changes contained in the given delta.
|
getAdapter
public static final String RESOURCE_MODEL_PROVIDER_ID
public static IModelProviderDescriptor getModelProviderDescriptor(String id)
null
if the provider has not been registered.id
- a model provider id.null
if the provider has not been registeredpublic static IModelProviderDescriptor[] getModelProviderDescriptors()
public final IModelProviderDescriptor getDescriptor()
initialize
method is invoked.public final String getId()
The model provider identifier is composed of the model provider's
plug-in id and the simple id of the provider extension. For example, if
plug-in "com.xyz"
defines a provider extension with id
"myModelProvider"
, the unique model provider identifier will be
"com.xyz.myModelProvider"
.
public ResourceMapping[] getMappings(IResource resource, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException
getMappings(IResource[], ResourceMappingContext, IProgressMonitor)
or getMappings(ResourceTraversal[], ResourceMappingContext, IProgressMonitor)
if more context is needed to determine the proper mappings.resource
- the resourcecontext
- a resource mapping contextmonitor
- a progress monitor, or null
if progress
reporting is not desiredCoreException
public ResourceMapping[] getMappings(IResource[] resources, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException
getMapping(IResource)
for each resource.
Subclasses may override this method.
resources
- the resourcescontext
- a resource mapping contextmonitor
- a progress monitor, or null
if progress
reporting is not desiredCoreException
public ResourceMapping[] getMappings(ResourceTraversal[] traversals, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException
getMappings(IResource[], ResourceMappingContext, IProgressMonitor)
with the resources extracted from each traversal.
Subclasses may override this method.
traversals
- the traversalscontext
- a resource mapping contextmonitor
- a progress monitor, or null
if progress
reporting is not desiredCoreException
public ResourceTraversal[] getTraversals(ResourceMapping[] mappings, ResourceMappingContext context, IProgressMonitor monitor) throws CoreException
The default implementation accumulates the traversals from the given mappings. Subclasses can override to provide a more optimal transformation.
mappings
- the mappings being mapped to resourcescontext
- the context used to determine the set of traversals that
cover the mappingsmonitor
- a progress monitor, or null
if progress
reporting is not desiredCoreException
public final void init(IModelProviderDescriptor desc)
initialize
method once the descriptor is set so subclasses
can override that method if they need to do additional initialization.desc
- the description of the provider as it appears in the plugin manifestprotected void initialize()
public IStatus validateChange(IResourceDelta delta, IProgressMonitor monitor)
This method must return either a ModelStatus
, or a MultiStatus
whose children are ModelStatus
. The severity of the returned status
indicates the severity of the possible side-effects of the operation. Any
severity other than OK
will be shown to the user. The
message should be a human readable message that will allow the user to
make a decision on whether to continue with the operation. The model
provider id should indicate which model is flagging the possible side effects.
This default implementation accepts all changes and returns a status with
severity OK
. Subclasses should override to perform
validation specific to their model.
delta
- a delta tree containing the proposed changesmonitor
- a progress monitor, or null
if progress
reporting is not desired
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.