Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.core.resources.mapping
Class ModelProvider


java.lang.Object
  extended by 

org.eclipse.core.runtime.PlatformObject
      extended by 
org.eclipse.core.resources.mapping.ModelProvider
All Implemented Interfaces:
IAdaptable

public abstract class ModelProvider
extends PlatformObject

Represents the provider of a logical model. The main purpose of this API is to support batch operations on sets of ResourceMapping objects that are part of the same model.

This class may be subclassed by clients.

Since:
3.2
See Also:
ResourceMapping

Field Summary
static  String RESOURCE_MODEL_PROVIDER_ID
          The model provider id of the Resources model.
 
Constructor Summary
ModelProvider ()
           
 
Method Summary
 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.
 
Methods inherited from class org.eclipse.core.runtime. PlatformObject
getAdapter
 
Methods inherited from class java.lang. Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_MODEL_PROVIDER_ID

public static final 
String RESOURCE_MODEL_PROVIDER_ID
The model provider id of the Resources model.

See Also:
Constant Field Values
Constructor Detail

ModelProvider

public ModelProvider()
Method Detail

getModelProviderDescriptor

public 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.

Parameters:
id - a model provider id.
Returns:
the descriptor for the model provider of the given id or null if the provider has not been registered

getModelProviderDescriptors

public static 
IModelProviderDescriptor[] getModelProviderDescriptors()
Return the descriptors for all model providers that are registered.

Returns:
the descriptors for all model providers that are registered.

equals

public boolean equals(
Object obj)
Overrides:
equals in class Object

getDescriptor

public final 
IModelProviderDescriptor getDescriptor()
Return the descriptor of this model provider. The descriptor is set during initialization so implements cannot call this method until after the initialize method is invoked.

Returns:
the descriptor of this model provider

getId

public final 
String getId()
Returns the unique identifier of this model provider.

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".

Returns:
the unique model provider identifier

getMappings

public 
ResourceMapping[] getMappings(
IResource resource,
                                     
ResourceMappingContext context,
                                     
IProgressMonitor monitor)
                              throws 
CoreException
Return the resource mappings that cover the given resource. By default, an empty array is returned. Subclass may override this method but should consider overriding either getMappings(IResource[], ResourceMappingContext, IProgressMonitor) or ( getMappings(ResourceTraversal[], ResourceMappingContext, IProgressMonitor) if more context is needed to determine the proper mappings.

Parameters:
resource - the resource
context - a resource mapping context
monitor - a progress monitor, or null if progress reporting is not desired
Returns:
the resource mappings that cover the given resource.
Throws:
CoreException

getMappings

public 
ResourceMapping[] getMappings(
IResource[] resources,
                                     
ResourceMappingContext context,
                                     
IProgressMonitor monitor)
                              throws 
CoreException
Return the set of mappings that cover the given resources. This method is used to map operations on resources to operations on resource mappings. By default, this method calls getMapping(IResource) for each resource.

Subclasses may override this method.

Parameters:
resources - the resources
context - a resource mapping context
monitor - a progress monitor, or null if progress reporting is not desired
Returns:
the set of mappings that cover the given resources
Throws:
CoreException

getMappings

public 
ResourceMapping[] getMappings(
ResourceTraversal[] traversals,
                                     
ResourceMappingContext context,
                                     
IProgressMonitor monitor)
                              throws 
CoreException
Return the set of mappings that overlap with the given resource traversals. This method is used to map operations on resources to operations on resource mappings. By default, this method calls getMappings(IResource[], ResourceMappingContext, IProgressMonitor) with the resources extract from each traversal.

Subclasses may override this method.

Parameters:
traversals - the traversals
context - a resource mapping context
monitor - a progress monitor, or null if progress reporting is not desired
Returns:
the set of mappings that overlap with the given resource traversals
Throws:
CoreException

getTraversals

public 
ResourceTraversal[] getTraversals(
ResourceMapping[] mappings,
                                         
ResourceMappingContext context,
                                         
IProgressMonitor monitor)
                                  throws 
CoreException
Return a set of traversals that cover the given resource mappings. The provided mappings must be from this provider or one of the providers this provider extends.

The default implementation accumulates the traversals from the given mappings. Subclasses can override to provide a more optimal transformation.

Parameters:
mappings - the mappings being mapped to resources
context - the context used to determine the set of traversals that cover the mappings
monitor - a progress monitor, or null if progress reporting is not desired
Returns:
a set of traversals that cover the given mappings
Throws:
CoreException

hashCode

public int hashCode()
Overrides:
hashCode in class Object

init

public final void init(
IModelProviderDescriptor desc)
This method is called by the model provider framework when the model provider is instantiated. This method should not be called by clients and cannot be overridden by subclasses. However, it invokes the initialize method once the descriptor is set so subclasses can override that method if they need to do additional initialization.

Parameters:
desc - the description of the provider as it appears in the plugin manifest

initialize

protected void initialize()
Initialization method that is called after the descriptor of this provider is set. Subclasses may override.


validateChange

public 
IStatus validateChange(
IResourceDelta delta,
                              
IProgressMonitor monitor)
Validate the proposed changes contained in the given delta.

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.

Parameters:
delta - a delta tree containing the proposed changes
monitor - a progress monitor, or null if progress reporting is not desired
Returns:
a status indicating any potential side effects on the model that provided this validator.

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire