org.eclipse.jst.server.core
Class ClasspathRuntimeTargetHandler

java.lang.Object
  extended byRuntimeTargetHandlerDelegate
      extended byorg.eclipse.jst.server.core.ClasspathRuntimeTargetHandler

public abstract class ClasspathRuntimeTargetHandler
extends RuntimeTargetHandlerDelegate

A runtime target handler that supports changing the classpath of the project by adding one or more classpath containers. Runtime providers can extend this class and implement the abstract methods to provide the correct build path for their runtime type.

Since:
1.0
See Also:
Serialized Form

Constructor Summary
ClasspathRuntimeTargetHandler()
           
 
Method Summary
abstract  java.lang.String getClasspathContainerLabel(IRuntime runtime, java.lang.String id)
          Returns the classpath container label for the given runtime and the given classpath container id (returned from getClasspathEntryIds()).
 java.lang.String[] getClasspathEntryIds()
          Returns the classpath entry ids for this runtime target handler.
 IClasspathEntry[] getDelegateClasspathEntries(IRuntime runtime, IProgressMonitor monitor)
          Returns the classpath entries that correspond to the given runtime.
 void removeRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor)
          (non-Javadoc)
 void requestClasspathContainerUpdate(IRuntime runtime, java.lang.String id, IClasspathEntry[] entries)
          Request that the classpath container for the given runtime and id be updated with the given classpath container entries.
abstract  IClasspathEntry[] resolveClasspathContainer(IRuntime runtime, java.lang.String id)
          Resolves (creates the classpath entries for) the classpath container with the given runtime and the given classpath container id (returned from getClasspathEntryIds()).
 IClasspathEntry[] resolveClasspathContainerImpl(IRuntime runtime, java.lang.String id)
          Resolve the classpath container.
 void setRuntimeTarget(IProject project, IRuntime runtime, IProgressMonitor monitor)
          (non-Javadoc)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClasspathRuntimeTargetHandler

public ClasspathRuntimeTargetHandler()
Method Detail

setRuntimeTarget

public void setRuntimeTarget(IProject project,
                             IRuntime runtime,
                             IProgressMonitor monitor)
                      throws CoreException
(non-Javadoc)

Throws:
CoreException
See Also:
RuntimeTargetHandlerDelegate#setRuntimeTarget(IProject, IRuntime, IProgressMonitor)

removeRuntimeTarget

public void removeRuntimeTarget(IProject project,
                                IRuntime runtime,
                                IProgressMonitor monitor)
(non-Javadoc)

See Also:
RuntimeTargetHandlerDelegate#removeRuntimeTarget(IProject, IRuntime, IProgressMonitor)

getDelegateClasspathEntries

public IClasspathEntry[] getDelegateClasspathEntries(IRuntime runtime,
                                                     IProgressMonitor monitor)
Returns the classpath entries that correspond to the given runtime.

Parameters:
runtime - a runtime
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
an array of classpath entries

getClasspathEntryIds

public java.lang.String[] getClasspathEntryIds()
Returns the classpath entry ids for this runtime target handler. These ids will be added to the classpath container id to create a new fully qualified classpath container id.

By default, there is a single classpath entry for the runtime, with no extra id (new String[1]). To create multiple ids, just return a string array containing the ids. For instance, to have two classpath containers with ids "id1" and "id2", use new String[] { "id1", "id2" }

Returns:
an array of classpath entry ids

requestClasspathContainerUpdate

public void requestClasspathContainerUpdate(IRuntime runtime,
                                            java.lang.String id,
                                            IClasspathEntry[] entries)
Request that the classpath container for the given runtime and id be updated with the given classpath container entries.

Parameters:
runtime - a runtime
id - an id
entries - an array of classpath entries

getClasspathContainerLabel

public abstract java.lang.String getClasspathContainerLabel(IRuntime runtime,
                                                            java.lang.String id)
Returns the classpath container label for the given runtime and the given classpath container id (returned from getClasspathEntryIds()). This method must not return null.

Parameters:
runtime - the runtime to resolve the container label for
id - the classpath entry id
Returns:
a classpath container label

resolveClasspathContainerImpl

public IClasspathEntry[] resolveClasspathContainerImpl(IRuntime runtime,
                                                       java.lang.String id)
Resolve the classpath container.

Parameters:
runtime - a runtime
id - a container id
Returns:
a possibly empty array of classpath entries

resolveClasspathContainer

public abstract IClasspathEntry[] resolveClasspathContainer(IRuntime runtime,
                                                            java.lang.String id)
Resolves (creates the classpath entries for) the classpath container with the given runtime and the given classpath container id (returned from getClasspathEntryIds()). If the classpath container cannot be resolved (for instance, if the runtime does not exist), return null.

Parameters:
runtime - the runtime to resolve the container for
id - the classpath entry id
Returns:
an array of classpath entries for the container, or null if the container could not be resolved