org.eclipse.jdt.internal.core
Class UserLibraryClasspathContainerInitializer

java.lang.Object
  extended by org.eclipse.jdt.core.ClasspathContainerInitializer
      extended by org.eclipse.jdt.internal.core.UserLibraryClasspathContainerInitializer

public class UserLibraryClasspathContainerInitializer
extends ClasspathContainerInitializer


Field Summary
 
Fields inherited from class org.eclipse.jdt.core.ClasspathContainerInitializer
ATTRIBUTE_NOT_SUPPORTED, ATTRIBUTE_READ_ONLY
 
Constructor Summary
UserLibraryClasspathContainerInitializer()
           
 
Method Summary
 boolean canUpdateClasspathContainer(org.eclipse.core.runtime.IPath containerPath, IJavaProject project)
          Returns true if this container initializer can be requested to perform updates on its own container values.
 java.lang.Object getComparisonID(org.eclipse.core.runtime.IPath containerPath, IJavaProject project)
          Returns an object which identifies a container for comparison purpose.
 java.lang.String getDescription(org.eclipse.core.runtime.IPath containerPath, IJavaProject project)
          Returns a readable description for a container path.
 void initialize(org.eclipse.core.runtime.IPath containerPath, IJavaProject project)
          Binds a classpath container to a IClasspathContainer for a given project, or silently fails if unable to do so.
 void requestClasspathContainerUpdate(org.eclipse.core.runtime.IPath containerPath, IJavaProject project, IClasspathContainer containerSuggestion)
          Request a registered container definition to be updated according to a container suggestion.
 
Methods inherited from class org.eclipse.jdt.core.ClasspathContainerInitializer
getAccessRulesStatus, getAttributeStatus, getFailureContainer, getSourceAttachmentStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserLibraryClasspathContainerInitializer

public UserLibraryClasspathContainerInitializer()
Method Detail

canUpdateClasspathContainer

public boolean canUpdateClasspathContainer(org.eclipse.core.runtime.IPath containerPath,
                                           IJavaProject project)
Description copied from class: ClasspathContainerInitializer
Returns true if this container initializer can be requested to perform updates on its own container values. If so, then an update request will be performed using ClasspathContainerInitializer.requestClasspathContainerUpdate(IPath, IJavaProject, IClasspathContainer).

Overrides:
canUpdateClasspathContainer in class ClasspathContainerInitializer
Parameters:
containerPath - the path of the container which requires to be updated
project - the project for which the container is to be updated
Returns:
returns true if the container can be updated

getComparisonID

public java.lang.Object getComparisonID(org.eclipse.core.runtime.IPath containerPath,
                                        IJavaProject project)
Description copied from class: ClasspathContainerInitializer
Returns an object which identifies a container for comparison purpose. This allows to eliminate redundant containers when accumulating classpath entries (e.g. runtime classpath computation). When requesting a container comparison ID, one should ensure using its corresponding container initializer. Indeed, a random container initializer cannot be held responsible for determining comparison IDs for arbitrary containers.

Overrides:
getComparisonID in class ClasspathContainerInitializer
Parameters:
containerPath - the path of the container which is being checked
project - the project for which the container is to being checked
Returns:
returns an Object identifying the container for comparison

getDescription

public java.lang.String getDescription(org.eclipse.core.runtime.IPath containerPath,
                                       IJavaProject project)
Description copied from class: ClasspathContainerInitializer
Returns a readable description for a container path. A readable description for a container path can be used for improving the display of references to container, without actually needing to resolve them. A good implementation should answer a description consistent with the description of the associated target container (see IClasspathContainer.getDescription()).

Overrides:
getDescription in class ClasspathContainerInitializer
Parameters:
containerPath - the path of the container which requires a readable description
project - the project from which the container is referenced
Returns:
a string description of the container
See Also:
ClasspathContainerInitializer.getDescription(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject)

initialize

public void initialize(org.eclipse.core.runtime.IPath containerPath,
                       IJavaProject project)
                throws org.eclipse.core.runtime.CoreException
Description copied from class: ClasspathContainerInitializer
Binds a classpath container to a IClasspathContainer for a given project, or silently fails if unable to do so.

A container is identified by a container path, which must be formed of two segments. The first segment is used as a unique identifier (which this initializer did register onto), and the second segment can be used as an additional hint when performing the resolution.

The initializer is invoked if a container path needs to be resolved for a given project, and no value for it was recorded so far. The implementation of the initializer would typically set the corresponding container using JavaCore#setClasspathContainer.

A container initialization can be indirectly performed while attempting to resolve a project classpath using IJavaProject#getResolvedClasspath(; or directly when using JavaCore#getClasspathContainer. During the initialization process, any attempt to further obtain the same container will simply return null so as to avoid an infinite regression of initializations.

A container initialization may also occur indirectly when setting a project classpath, as the operation needs to resolve the classpath for validation purpose. While the operation is in progress, a referenced container initializer may be invoked. If the initializer further tries to access the referring project classpath, it will not see the new assigned classpath until the operation has completed. Note that once the Java change notification occurs (at the end of the operation), the model has been updated, and the project classpath can be queried normally.

This method is called by the Java model to give the party that defined this particular kind of classpath container the chance to install classpath container objects that will be used to convert classpath container entries into simpler classpath entries. The method is typically called exactly once for a given Java project and classpath container entry. This method must not be called by other clients.

There are a wide variety of conditions under which this method may be invoked. To ensure that the implementation does not interfere with correct functioning of the Java model, the implementation should use only the following Java model APIs:

The effects of using other Java model APIs are unspecified.

Specified by:
initialize in class ClasspathContainerInitializer
Parameters:
containerPath - a two-segment path (ID/hint) identifying the container that needs to be resolved
project - the Java project in which context the container is to be resolved. This allows generic containers to be bound with project specific values.
Throws:
org.eclipse.core.runtime.CoreException - if an exception occurs during the initialization
See Also:
JavaCore.getClasspathContainer(IPath, IJavaProject), JavaCore.setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], org.eclipse.core.runtime.IProgressMonitor), IClasspathContainer

requestClasspathContainerUpdate

public void requestClasspathContainerUpdate(org.eclipse.core.runtime.IPath containerPath,
                                            IJavaProject project,
                                            IClasspathContainer containerSuggestion)
                                     throws org.eclipse.core.runtime.CoreException
Description copied from class: ClasspathContainerInitializer
Request a registered container definition to be updated according to a container suggestion. The container suggestion only acts as a place-holder to pass along the information to update the matching container definition(s) held by the container initializer. In particular, it is not expected to store the container suggestion as is, but rather adjust the actual container definition based on suggested changes.

IMPORTANT: In reaction to receiving an update request, a container initializer will update the corresponding container definition (after reconciling changes) at its earliest convenience, using JavaCore.setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor). Until it does so, the update will not be reflected in the Java Model.

In order to anticipate whether the container initializer allows to update its containers, the predicate ClasspathContainerInitializer.canUpdateClasspathContainer(IPath, IJavaProject) should be used.

Overrides:
requestClasspathContainerUpdate in class ClasspathContainerInitializer
Parameters:
containerPath - the path of the container which requires to be updated
project - the project for which the container is to be updated
containerSuggestion - a suggestion to update the corresponding container definition
Throws:
org.eclipse.core.runtime.CoreException - when JavaCore#setClasspathContainer would throw any.
See Also:
ClasspathContainerInitializer.requestClasspathContainerUpdate(org.eclipse.core.runtime.IPath, org.eclipse.jdt.core.IJavaProject, org.eclipse.jdt.core.IClasspathContainer)