|
Eclipse JDT Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.launching.JavaRuntime
The central access point for launching support. This class manages
the registered VM types contributed through the
"org.eclipse.jdt.launching.vmType"
extension point.
As well, this class provides VM install change notification,
and computes classpaths and source lookup paths for launch
configurations.
This class provides static methods only; it is not intended to be instantiated or subclassed by clients.
Field Summary | |
static String |
ATTR_CMDLINE
Deprecated. - use IProcess.ATTR_CMDLINE |
static int |
DEF_CONNECT_TIMEOUT
Default launch/connect timeout (ms). |
static int |
ERR_UNABLE_TO_RESOLVE_JRE
A status code indicating that a JRE could not be resolved for a project. |
static String |
EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS
Simple identifier constant (value "runtimeClasspathEntryResolvers" ) for the
runtime classpath entry resolvers extension point. |
static String |
EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS
Simple identifier constant (value "classpathProviders" ) for the
runtime classpath providers extension point. |
static String |
JRE_CONTAINER
Classpath container used for a project's JRE (value "org.eclipse.jdt.launching.JRE_CONTAINER" ). |
static String |
JRELIB_VARIABLE
Classpath variable name used for the default JRE's library (value "JRE_LIB" ). |
static String |
JRESRC_VARIABLE
Classpath variable name used for the default JRE's library source (value "JRE_SRC" ). |
static String |
JRESRCROOT_VARIABLE
Classpath variable name used for the default JRE's library source root (value "JRE_SRCROOT" ). |
static String |
PREF_CONNECT_TIMEOUT
Preference key for launch/connect timeout. |
static String |
PREF_VM_XML
Preference key for the String of XML that defines all installed VMs. |
Method Summary | |
static void |
addContainerResolver(IRuntimeClasspathEntryResolver resolver,
String containerIdentifier)
Registers the given resolver for the specified container. |
static void |
addVariableResolver(IRuntimeClasspathEntryResolver resolver,
String variableName)
Registers the given resolver for the specified variable. |
static void |
addVMInstallChangedListener(IVMInstallChangedListener listener)
Adds the given listener to the list of registered VM install changed listeners. |
static String[] |
computeDefaultRuntimeClassPath(IJavaProject jproject)
Computes the default application classpath entries for the given project. |
static IRuntimeClasspathEntry[] |
computeUnresolvedRuntimeClasspath(IJavaProject project)
Computes and returns the default unresolved runtime claspath for the given project. |
static IRuntimeClasspathEntry[] |
computeUnresolvedRuntimeClasspath(org.eclipse.debug.core.ILaunchConfiguration configuration)
Computes and returns the unresolved class path for the given launch configuration. |
static IRuntimeClasspathEntry[] |
computeUnresolvedSourceLookupPath(org.eclipse.debug.core.ILaunchConfiguration configuration)
Computes and returns the unresolved source lookup path for the given launch configuration. |
static IVMInstall |
computeVMInstall(org.eclipse.debug.core.ILaunchConfiguration configuration)
Returns the VM install for the given launch configuration. |
static void |
fireVMAdded(IVMInstall vm)
Notifies all VM install changed listeners of the VM addition |
static void |
fireVMChanged(PropertyChangeEvent event)
Notifies all VM install changed listeners of the given property change. |
static void |
fireVMRemoved(IVMInstall vm)
Notifies all VM install changed listeners of the VM removal |
static IRuntimeClasspathProvider |
getClasspathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration)
Returns the classpath provider for the given launch configuration. |
static String |
getCompositeIdFromVM(IVMInstall vm)
Returns a String that uniquely identifies the specified VM across all VM types. |
static IClasspathEntry |
getDefaultJREContainerEntry()
Creates and returns a classpath entry describing the default JRE container entry. |
static IVMConnector |
getDefaultVMConnector()
Return the default VM connector. |
static IVMInstall |
getDefaultVMInstall()
Return the default VM set with setDefaultVM() . |
static IJavaProject |
getJavaProject(org.eclipse.debug.core.ILaunchConfiguration configuration)
Return the IJavaProject referenced in the specified configuration or
null if none. |
static IClasspathEntry |
getJREVariableEntry()
Creates and returns a classpath entry describing the JRE_LIB classpath variable. |
static LibraryLocation[] |
getLibraryLocations(IVMInstall vm)
Evaluates library locations for a IVMInstall. |
static org.eclipse.core.runtime.Preferences |
getPreferences()
Returns the preference store for the launching plug-in. |
static String |
getProjectOutputDirectory(org.eclipse.debug.core.ILaunchConfiguration config)
Return the String representation of the default output directory of the launch config's project or null if there is no config, no
project or some sort of problem. |
static IRuntimeClasspathProvider |
getSourceLookupPathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration)
Returns the source lookup path provider for the given launch configuration. |
static IVMConnector |
getVMConnector(String id)
Returns the VM connector defined with the specified identifier, or null if none. |
static IVMConnector[] |
getVMConnectors()
Returns all VM connector extensions. |
static IVMInstall |
getVMFromCompositeId(String idString)
Return the VM corrseponding to the specified composite Id. |
static IVMInstall |
getVMInstall(IJavaProject project)
Returns the VM assigned to build the given Java project. |
static IVMInstallType |
getVMInstallType(String id)
Returns the VM install type with the given unique id. |
static IVMInstallType[] |
getVMInstallTypes()
Returns the list of registered VM types. |
static IRuntimeClasspathEntry |
newArchiveRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path)
Returns a new runtime classpath entry for the given archive (possibly external). |
static IRuntimeClasspathEntry |
newArchiveRuntimeClasspathEntry(org.eclipse.core.resources.IResource resource)
Returns a new runtime classpath entry for the given archive. |
static IRuntimeClasspathEntry |
newDefaultProjectClasspathEntry(IJavaProject project)
Returns a new runtime classpath entry containing the default classpath for the specified Java project. |
static IRuntimeClasspathEntry |
newProjectRuntimeClasspathEntry(IJavaProject project)
Returns a new runtime classpath entry for the given project. |
static IRuntimeClasspathEntry |
newRuntimeClasspathEntry(String memento)
Returns a runtime classpath entry constructed from the given memento. |
static IRuntimeClasspathEntry |
newRuntimeContainerClasspathEntry(org.eclipse.core.runtime.IPath path,
int classpathProperty)
Returns a runtime classpath entry for the given container path with the given classpath property. |
static IRuntimeClasspathEntry |
newRuntimeContainerClasspathEntry(org.eclipse.core.runtime.IPath path,
int classpathProperty,
IJavaProject project)
Returns a runtime classpath entry for the given container path with the given classpath property to be resolved in the context of the given Java project. |
static IRuntimeClasspathEntry |
newStringVariableClasspathEntry(String expression)
Returns a new runtime classpath entry for the given expression that may contain string substitution variable references. |
static IRuntimeClasspathEntry |
newVariableRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path)
Returns a new runtime classpath entry for the classpath variable with the given path. |
static void |
removeVMInstallChangedListener(IVMInstallChangedListener listener)
Removes the given listener from the list of registered VM install changed listeners. |
static IRuntimeClasspathEntry[] |
resolveRuntimeClasspath(IRuntimeClasspathEntry[] entries,
org.eclipse.debug.core.ILaunchConfiguration configuration)
Resolves the given classpath, returning the resolved classpath in the context of the given launch configuration. |
static IRuntimeClasspathEntry[] |
resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry,
IJavaProject project)
Returns resolved entries for the given entry in the context of the given Java project. |
static IRuntimeClasspathEntry[] |
resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry,
org.eclipse.debug.core.ILaunchConfiguration configuration)
Returns resolved entries for the given entry in the context of the given launch configuration. |
static IRuntimeClasspathEntry[] |
resolveSourceLookupPath(IRuntimeClasspathEntry[] entries,
org.eclipse.debug.core.ILaunchConfiguration configuration)
Resolves the given source lookup path, returning the resolved source lookup path in the context of the given launch configuration. |
static void |
savePreferences()
Saves the preferences for the launching plug-in. |
static void |
saveVMConfiguration()
Saves the VM configuration information to the preferences. |
static void |
setDefaultVMConnector(IVMConnector connector,
org.eclipse.core.runtime.IProgressMonitor monitor)
Sets a VM connector as the system-wide default VM. |
static void |
setDefaultVMInstall(IVMInstall vm,
org.eclipse.core.runtime.IProgressMonitor monitor)
Sets a VM as the system-wide default VM, and notifies registered VM install change listeners of the change. |
static void |
setDefaultVMInstall(IVMInstall vm,
org.eclipse.core.runtime.IProgressMonitor monitor,
boolean savePreference)
Sets a VM as the system-wide default VM, and notifies registered VM install change listeners of the change. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String JRELIB_VARIABLE
"JRE_LIB"
).
public static final String JRESRC_VARIABLE
"JRE_SRC"
).
public static final String JRESRCROOT_VARIABLE
"JRE_SRCROOT"
).
public static final String EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS
"runtimeClasspathEntryResolvers"
) for the
runtime classpath entry resolvers extension point.
public static final String EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS
"classpathProviders"
) for the
runtime classpath providers extension point.
public static final String JRE_CONTAINER
"org.eclipse.jdt.launching.JRE_CONTAINER"
). A
container is resolved in the context of a specific Java project, to one
or more system libraries contained in a JRE. The container can have zero
or two path segments following the container name. When no segments
follow the container name, the workspace default JRE is used to build a
project. Otherwise the segments identify a specific JRE used to build a
project:
IBM 1.3.1
. This information is
shared in a projects classpath file, so teams must agree on JRE naming
conventions.
public static final int ERR_UNABLE_TO_RESOLVE_JRE
source
object provided
to the status handler is the Java project for which the path could not be
resolved. The status handler must return an IVMInstall
or null
.
The container resolver will re-set the project's classpath if required.
public static final String PREF_CONNECT_TIMEOUT
public static final String PREF_VM_XML
public static final int DEF_CONNECT_TIMEOUT
public static final String ATTR_CMDLINE
IProcess.ATTR_CMDLINE
org.eclipse.debug.core.model.IProcess
allows attaching
String properties to processes.
The value of this attribute is the command line a process
was launched with. Implementers of IVMRunner
should use
this attribute key to attach the command lines to the processes they create.
Method Detail |
public static IVMInstall getVMInstall(IJavaProject project) throws org.eclipse.core.runtime.CoreException
project
- the project to retrieve the VM from
null
if no VM is referenced on the project's build path.
org.eclipse.core.runtime.CoreException
- if unable to determine the project's VM installpublic static IVMInstallType getVMInstallType(String id)
id
- the VM install type unique id
null
if no
VM install type with the given id is registered.public static void setDefaultVMInstall(IVMInstall vm, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
vm
- The vm to make the default. May be null
to clear
the default.monitor
- progress monitor or null
org.eclipse.core.runtime.CoreException
public static void setDefaultVMInstall(IVMInstall vm, org.eclipse.core.runtime.IProgressMonitor monitor, boolean savePreference) throws org.eclipse.core.runtime.CoreException
vm
- The vm to make the default. May be null
to clear
the default.monitor
- progress monitor or null
savePreference
- If true
, update workbench preferences to reflect
the new default VM.
org.eclipse.core.runtime.CoreException
public static void setDefaultVMConnector(IVMConnector connector, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException
connector
- The connector to make the default. May be null
to clear
the default.monitor
- The progress monitor to use
org.eclipse.core.runtime.CoreException
- Thrown if saving the new default setting failspublic static IVMInstall getDefaultVMInstall()
setDefaultVM()
.
null
when no default
VM was set or when the default VM has been disposed.public static IVMConnector getDefaultVMConnector()
public static IVMInstallType[] getVMInstallTypes()
"org.eclipse.jdt.launching.vmTypes"
extension point.
Returns an empty list if there are no registered VM types.
public static String getCompositeIdFromVM(IVMInstall vm)
vm
- the instance of IVMInstallType to be indentifiedpublic static IVMInstall getVMFromCompositeId(String idString)
idString
- the composite id that specifies an instance of IVMInstallpublic static IRuntimeClasspathEntry newStringVariableClasspathEntry(String expression)
expression
- an expression that resolves to the location of an archive
public static IRuntimeClasspathEntry newDefaultProjectClasspathEntry(IJavaProject project)
project
- Java project
public static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(IJavaProject project)
project
- Java project
public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.resources.IResource resource)
resource
- archive resource
public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path)
path
- absolute path to an archive
public static IRuntimeClasspathEntry newVariableRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path)
path
- variable path; first segment is the name of the variable;
trailing segments are appended to the resolved variable value
public static IRuntimeClasspathEntry newRuntimeContainerClasspathEntry(org.eclipse.core.runtime.IPath path, int classpathProperty) throws org.eclipse.core.runtime.CoreException
path
- container pathclasspathProperty
- the type of entry - one of USER_CLASSES
,
BOOTSTRAP_CLASSES
, or STANDARD_CLASSES
org.eclipse.core.runtime.CoreException
- if unable to construct a runtime classpath entrypublic static IRuntimeClasspathEntry newRuntimeContainerClasspathEntry(org.eclipse.core.runtime.IPath path, int classpathProperty, IJavaProject project) throws org.eclipse.core.runtime.CoreException
path
- container pathclasspathProperty
- the type of entry - one of USER_CLASSES
,
BOOTSTRAP_CLASSES
, or STANDARD_CLASSES
project
- Java project context used for resolution, or null
if to be resolved in the context of the launch configuration this entry
is referenced in
org.eclipse.core.runtime.CoreException
- if unable to construct a runtime classpath entrypublic static IRuntimeClasspathEntry newRuntimeClasspathEntry(String memento) throws org.eclipse.core.runtime.CoreException
memento
- a memento for a runtime classpath entry
org.eclipse.core.runtime.CoreException
- if unable to construct a runtime classpath entrypublic static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(IJavaProject project) throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
- if unable to compute the runtime classpathIRuntimeClasspathEntry
public static IRuntimeClasspathEntry[] computeUnresolvedSourceLookupPath(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
configuration
- launch configuration
org.eclipse.core.runtime.CoreException
- if unable to compute the source lookup pathpublic static IRuntimeClasspathEntry[] resolveSourceLookupPath(IRuntimeClasspathEntry[] entries, org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
entries
- unresolved entriesconfiguration
- launch configuration
org.eclipse.core.runtime.CoreException
- if unable to resolve the source lookup pathpublic static IRuntimeClasspathProvider getClasspathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
configuration
- launch configuration
org.eclipse.core.runtime.CoreException
- if unable to resolve the path providerpublic static IRuntimeClasspathProvider getSourceLookupPathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
configuration
- launch configuration
org.eclipse.core.runtime.CoreException
- if unable to resolve the path providerpublic static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
VARIABLE
or CONTAINER
, variable and contanier
resolvers are consulted. If the entry is of kind PROJECT
,
and the associated Java project specifies non-default output locations,
the corresponding output locations are returned. Otherwise, the given
entry is returned.
If the given entry is a variable entry, and a resolver is not registered, the entry itself is returned. If the given entry is a container, and a resolver is not registered, resolved runtime classpath entries are calculated from the associated container classpath entries, in the context of the project associated with the given launch configuration.
entry
- runtime classpath entryconfiguration
- launch configuration
org.eclipse.core.runtime.CoreException
- if unable to resolveIRuntimeClasspathEntryResolver
public static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry, IJavaProject project) throws org.eclipse.core.runtime.CoreException
VARIABLE
or CONTAINER
, variable and contanier
resolvers are consulted. If the entry is of kind PROJECT
,
and the associated Java project specifies non-default output locations,
the corresponding output locations are returned. Otherwise, the given
entry is returned.
If the given entry is a variable entry, and a resolver is not registered, the entry itself is returned. If the given entry is a container, and a resolver is not registered, resolved runtime classpath entries are calculated from the associated container classpath entries, in the context of the given project.
entry
- runtime classpath entryproject
- Java project context
org.eclipse.core.runtime.CoreException
- if unable to resolveIRuntimeClasspathEntryResolver
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
configuration
- launch configuration
org.eclipse.core.runtime.CoreException
- if unable to compute the classpathpublic static IRuntimeClasspathEntry[] resolveRuntimeClasspath(IRuntimeClasspathEntry[] entries, org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
entries
- unresolved classpathconfiguration
- launch configuration
org.eclipse.core.runtime.CoreException
- if unable to compute the classpathpublic static IJavaProject getJavaProject(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
IJavaProject
referenced in the specified configuration or
null
if none.
org.eclipse.core.runtime.CoreException
- if the referenced Java project does not existpublic static IVMInstall computeVMInstall(org.eclipse.debug.core.ILaunchConfiguration configuration) throws org.eclipse.core.runtime.CoreException
ATTR_VM_INSTALL_TYPE
and ATTR_VM_INSTALL_ID
attributes.
configuration
- launch configuration
org.eclipse.core.runtime.CoreException
- if unable to compute a vm installpublic static String[] computeDefaultRuntimeClassPath(IJavaProject jproject) throws org.eclipse.core.runtime.CoreException
jproject
- The project to compute the classpath for
org.eclipse.core.runtime.CoreException
- if unable to compute the default classpathpublic static void saveVMConfiguration() throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException
public static LibraryLocation[] getLibraryLocations(IVMInstall vm)
public static IClasspathEntry getJREVariableEntry()
public static IClasspathEntry getDefaultJREContainerEntry()
public static IVMConnector getVMConnector(String id)
null
if none.
id
- VM connector identifier
null
if nonepublic static IVMConnector[] getVMConnectors()
public static org.eclipse.core.runtime.Preferences getPreferences()
public static void savePreferences()
public static void addVariableResolver(IRuntimeClasspathEntryResolver resolver, String variableName)
resolver
- runtime classpathe entry resolvervariableName
- variable name to register forpublic static void addContainerResolver(IRuntimeClasspathEntryResolver resolver, String containerIdentifier)
resolver
- runtime classpathe entry resolvercontainerIdentifier
- identifier of the classpath container to register forpublic static void addVMInstallChangedListener(IVMInstallChangedListener listener)
listener
- the listener to addpublic static void removeVMInstallChangedListener(IVMInstallChangedListener listener)
listener
- the listener to removepublic static void fireVMChanged(PropertyChangeEvent event)
event
- event describing the change.public static void fireVMAdded(IVMInstall vm)
vm
- the VM that has been addedpublic static void fireVMRemoved(IVMInstall vm)
vm
- the VM that has been removedpublic static String getProjectOutputDirectory(org.eclipse.debug.core.ILaunchConfiguration config)
null
if there is no config, no
project or some sort of problem.
|
Eclipse JDT Release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |