Eclipse JDT
2.0

org.eclipse.jdt.launching
Class AbstractJavaLaunchConfigurationDelegate

java.lang.Object
  |
  +--org.eclipse.jdt.launching.AbstractJavaLaunchConfigurationDelegate
All Implemented Interfaces:
ILaunchConfigurationDelegate

public abstract class AbstractJavaLaunchConfigurationDelegate
extends Object
implements ILaunchConfigurationDelegate

Abstract implementation of a Java launch configuration delegate. Provides convenience methods for accessing and verifying launch configuration attributes.

Clients implementing Java launch configuration delegates should subclass this class.

Since:
2.0

Constructor Summary
AbstractJavaLaunchConfigurationDelegate()
           
 
Method Summary
protected  void abort(String message, Throwable exception, int code)
          Throws a core exception with an error status object built from the given message, lower level exception, and error code.
 String[] getBootpath(ILaunchConfiguration configuration)
          Returns entries that should appear on the bootstrap portion of the classpath as specified by the given launch configuration, as an array of resolved strings.
 String[] getClasspath(ILaunchConfiguration configuration)
          Returns the entries that should appear on the user portion of the classpath as specified by the given launch configuration, as an array of resolved strings.
 IJavaProject getJavaProject(ILaunchConfiguration configuration)
          Returns the Java project specified by the given launch configuration, or null if none.
 String getJavaProjectName(ILaunchConfiguration configuration)
          Returns the Java project name specified by the given launch configuration, or null if none.
protected  ILaunchManager getLaunchManager()
          Convenience method to get the launch manager.
 String getMainTypeName(ILaunchConfiguration configuration)
          Returns the main type name specified by the given launch configuration, or null if none.
 String getProgramArguments(ILaunchConfiguration configuration)
          Returns the program arguments specified by the given launch configuration, as a string.
 String getVMArguments(ILaunchConfiguration configuration)
          Returns the VM arguments specified by the given launch configuration, as a string.
 String getVMConnectorId(ILaunchConfiguration configuration)
          Returns the VM connector identifier specified by the given launch configuration, or null if none.
 IVMInstall getVMInstall(ILaunchConfiguration configuration)
          Returns the VM install specified by the given launch configuration, or null if none.
 String getVMInstallName(ILaunchConfiguration configuration)
          Returns the VM install name specified by the given launch configuration, or null if none.
 IVMInstallType getVMInstallType(ILaunchConfiguration configuration)
          Returns the VM install type specified by the given launch configuration, or null if none.
 String getVMInstallTypeId(ILaunchConfiguration configuration)
          Returns the VM install type identifier specified by the given launch configuration, or null if none.
 Map getVMSpecificAttributesMap(ILaunchConfiguration configuration)
          Returns the Map of VM-specific attributes specified by the given launch configuration, or null if none.
 File getWorkingDirectory(ILaunchConfiguration configuration)
          Returns the working directory specified by the given launch configuration, or null if none.
 IPath getWorkingDirectoryPath(ILaunchConfiguration configuration)
          Returns the working directory path specified by the given launch configuration, or null if none.
 boolean isAllowTerminate(ILaunchConfiguration configuration)
          Returns whether the given launch configuration specifies that termination is allowed.
protected  void setDefaultSourceLocator(ILaunch launch, ILaunchConfiguration configuration)
          Assigns a default source locator to the given launch if a source locator has not yet been assigned to it, and the associated launch configuration does not specify a source locator.
 IJavaProject verifyJavaProject(ILaunchConfiguration configuration)
          Verifies a Java project is specified by the given launch configuration, and returns the Java project.
 String verifyMainTypeName(ILaunchConfiguration configuration)
          Verifies a main type name is specified by the given launch configuration, and returns the main type name.
 IVMInstall verifyVMInstall(ILaunchConfiguration configuration)
          Verifies the VM install specified by the given launch configuration - i.e.
 File verifyWorkingDirectory(ILaunchConfiguration configuration)
          Verifies the working directory specified by the given launch configuration exists, and returns the working directory, or null if none is specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.debug.core.model.ILaunchConfigurationDelegate
launch
 

Constructor Detail

AbstractJavaLaunchConfigurationDelegate

public AbstractJavaLaunchConfigurationDelegate()
Method Detail

getLaunchManager

protected ILaunchManager getLaunchManager()
Convenience method to get the launch manager.

Returns:
the launch manager

abort

protected void abort(String message,
                     Throwable exception,
                     int code)
              throws CoreException
Throws a core exception with an error status object built from the given message, lower level exception, and error code.

Parameters:
message - the status message
exception - lower level exception associated with the error, or null if none
code - error code
CoreException

getVMInstall

public IVMInstall getVMInstall(ILaunchConfiguration configuration)
                        throws CoreException
Returns the VM install specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the VM install specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

getVMInstallName

public String getVMInstallName(ILaunchConfiguration configuration)
                        throws CoreException
Returns the VM install name specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the VM install name specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

getVMInstallType

public IVMInstallType getVMInstallType(ILaunchConfiguration configuration)
                                throws CoreException
Returns the VM install type specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the VM install type specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

getVMInstallTypeId

public String getVMInstallTypeId(ILaunchConfiguration configuration)
                          throws CoreException
Returns the VM install type identifier specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the VM install type identifier specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

verifyVMInstall

public IVMInstall verifyVMInstall(ILaunchConfiguration configuration)
                           throws CoreException
Verifies the VM install specified by the given launch configuration - i.e. that its home location is specified and exists, and returns the VM install.

Parameters:
configuration - launch configuration
Returns:
the VM install specified by the given launch configuration
Throws:
CoreException - if unable to retrieve the attribute, the attribute is unspecified, or if the home location is unspecified or does not exist

getVMConnectorId

public String getVMConnectorId(ILaunchConfiguration configuration)
                        throws CoreException
Returns the VM connector identifier specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the VM connector identifier specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

getBootpath

public String[] getBootpath(ILaunchConfiguration configuration)
                     throws CoreException
Returns entries that should appear on the bootstrap portion of the classpath as specified by the given launch configuration, as an array of resolved strings. The returned array is null if all entries are standard (i.e. appear by default), or empty to represent an empty bootpath.

Parameters:
configuration - launch configuration
Returns:
the bootpath specified by the given launch configuration. An empty bootpath is specfied by an empty array, and null represents a default boothpath.
Throws:
CoreException - if unable to retrieve the attribute

getClasspath

public String[] getClasspath(ILaunchConfiguration configuration)
                      throws CoreException
Returns the entries that should appear on the user portion of the classpath as specified by the given launch configuration, as an array of resolved strings. The returned array is empty if no classpath is specified.

Parameters:
configuration - launch configuration
Returns:
the classpath specified by the given launch configuration, possibly an empty array
Throws:
CoreException - if unable to retrieve the attribute

getJavaProject

public IJavaProject getJavaProject(ILaunchConfiguration configuration)
                            throws CoreException
Returns the Java project specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the Java project specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

getJavaProjectName

public String getJavaProjectName(ILaunchConfiguration configuration)
                          throws CoreException
Returns the Java project name specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the Java project name specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

getMainTypeName

public String getMainTypeName(ILaunchConfiguration configuration)
                       throws CoreException
Returns the main type name specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the main type name specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

getProgramArguments

public String getProgramArguments(ILaunchConfiguration configuration)
                           throws CoreException
Returns the program arguments specified by the given launch configuration, as a string. The returned string is empty if no program arguments are specified.

Parameters:
configuration - launch configuration
Returns:
the program arguments specified by the given launch configuration, possibly an empty string
Throws:
CoreException - if unable to retrieve the attribute

getVMArguments

public String getVMArguments(ILaunchConfiguration configuration)
                      throws CoreException
Returns the VM arguments specified by the given launch configuration, as a string. The returned string is empty if no VM arguments are specified.

Parameters:
configuration - launch configuration
Returns:
the VM arguments specified by the given launch configuration, possibly an empty string
Throws:
CoreException - if unable to retrieve the attribute

getVMSpecificAttributesMap

public Map getVMSpecificAttributesMap(ILaunchConfiguration configuration)
                               throws CoreException
Returns the Map of VM-specific attributes specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the Map of VM-specific attributes
Throws:
CoreException - if unable to retrieve the attribute

getWorkingDirectory

public File getWorkingDirectory(ILaunchConfiguration configuration)
                         throws CoreException
Returns the working directory specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the working directory specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

getWorkingDirectoryPath

public IPath getWorkingDirectoryPath(ILaunchConfiguration configuration)
                              throws CoreException
Returns the working directory path specified by the given launch configuration, or null if none.

Parameters:
configuration - launch configuration
Returns:
the working directory path specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

verifyJavaProject

public IJavaProject verifyJavaProject(ILaunchConfiguration configuration)
                               throws CoreException
Verifies a Java project is specified by the given launch configuration, and returns the Java project.

Parameters:
configuration - launch configuration
Returns:
the Java project specified by the given launch configuration
Throws:
CoreException - if unable to retrieve the attribute or the attribute is unspecified

verifyMainTypeName

public String verifyMainTypeName(ILaunchConfiguration configuration)
                          throws CoreException
Verifies a main type name is specified by the given launch configuration, and returns the main type name.

Parameters:
configuration - launch configuration
Returns:
the main type name specified by the given launch configuration
Throws:
CoreException - if unable to retrieve the attribute or the attribute is unspecified

verifyWorkingDirectory

public File verifyWorkingDirectory(ILaunchConfiguration configuration)
                            throws CoreException
Verifies the working directory specified by the given launch configuration exists, and returns the working directory, or null if none is specified.

Parameters:
configuration - launch configuration
Returns:
the working directory specified by the given launch configuration, or null if none
Throws:
CoreException - if unable to retrieve the attribute

isAllowTerminate

public boolean isAllowTerminate(ILaunchConfiguration configuration)
                         throws CoreException
Returns whether the given launch configuration specifies that termination is allowed.

Parameters:
configuration - launch configuration
Returns:
whether termination is allowed
Throws:
CoreException - if unable to retrieve the attribute

setDefaultSourceLocator

protected void setDefaultSourceLocator(ILaunch launch,
                                       ILaunchConfiguration configuration)
                                throws CoreException
Assigns a default source locator to the given launch if a source locator has not yet been assigned to it, and the associated launch configuration does not specify a source locator.

Parameters:
launch - launch object
configuration - configuration being launched
Throws:
CoreException - if unable to set the source locator

Eclipse JDT
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.