Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.jdt.launching
Class JavaRuntime  view JavaRuntime download JavaRuntime.java

java.lang.Object
  extended byorg.eclipse.jdt.launching.JavaRuntime

public final class JavaRuntime
extends java.lang.Object

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 java.lang.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 java.lang.String EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS
          Simple identifier constant (value "runtimeClasspathEntryResolvers") for the runtime classpath entry resolvers extension point.
static java.lang.String EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS
          Simple identifier constant (value "classpathProviders") for the runtime classpath providers extension point.
private static java.util.Map fgContainerResolvers
           
private static IRuntimeClasspathProvider fgDefaultClasspathProvider
          Default classpath and source path providers.
private static IRuntimeClasspathProvider fgDefaultSourcePathProvider
           
private static java.lang.String fgDefaultVMConnectorId
           
private static java.lang.String fgDefaultVMId
           
private static java.util.Map fgPathProviders
          Path providers keyed by id
private static java.util.Map fgRuntimeClasspathEntryResolvers
           
private static java.util.Map fgVariableResolvers
          Resolvers keyed by variable name, container id, and runtime classpath entry id.
private static org.eclipse.jdt.internal.launching.ListenerList fgVMListeners
          VM change listeners
private static IVMInstallType[] fgVMTypes
           
static java.lang.String JRE_CONTAINER
          Classpath container used for a project's JRE (value "org.eclipse.jdt.launching.JRE_CONTAINER").
static java.lang.String JRELIB_VARIABLE
          Classpath variable name used for the default JRE's library (value "JRE_LIB").
static java.lang.String JRESRC_VARIABLE
          Classpath variable name used for the default JRE's library source (value "JRE_SRC").
static java.lang.String JRESRCROOT_VARIABLE
          Classpath variable name used for the default JRE's library source root (value "JRE_SRCROOT").
static java.lang.String PREF_CONNECT_TIMEOUT
          Preference key for launch/connect timeout.
static java.lang.String PREF_VM_XML
          Preference key for the String of XML that defines all installed VMs.
 
Constructor Summary
private JavaRuntime()
          This class contains only static methods, and is not intended to be instantiated.
 
Method Summary
private static void abort(java.lang.String message, int code, java.lang.Throwable exception)
          Throws a core exception with an internal error status.
private static void abort(java.lang.String message, java.lang.Throwable exception)
          Throws a core exception with an internal error status.
static void addContainerResolver(IRuntimeClasspathEntryResolver resolver, java.lang.String containerIdentifier)
          Registers the given resolver for the specified container.
static void addVariableResolver(IRuntimeClasspathEntryResolver resolver, java.lang.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.
private static IRuntimeClasspathEntry[] computeDefaultContainerEntries(IRuntimeClasspathEntry entry, org.eclipse.jdt.core.IJavaProject project)
          Performs default resolution for a container entry.
private static IRuntimeClasspathEntry[] computeDefaultContainerEntries(IRuntimeClasspathEntry entry, org.eclipse.debug.core.ILaunchConfiguration config)
          Performs default resolution for a container entry.
static java.lang.String[] computeDefaultRuntimeClassPath(org.eclipse.jdt.core.IJavaProject jproject)
          Computes the default application classpath entries for the given project.
static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(org.eclipse.jdt.core.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.
private static void detectAndSaveVMDefinitions()
          Detects VM installations, and a default VM (if required).
private static void detectDefaultVM()
          Tries to locate a default VM (if one is not currently set).
private static VMStandin detectEclipseRuntime()
          Detect the VM that Eclipse is running on.
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
private static java.lang.String generateDetectedVMName(IVMInstall vm)
          Make the name of a detected VM stand out.
static IRuntimeClasspathProvider getClasspathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Returns the classpath provider for the given launch configuration.
private static java.util.Map getClasspathProviders()
          Returns all registered classpath providers.
static java.lang.String getCompositeIdFromVM(IVMInstall vm)
          Returns a String that uniquely identifies the specified VM across all VM types.
private static IRuntimeClasspathEntryResolver getContainerResolver(java.lang.String containerId)
          Returns the resolver registered for the given container id, or null if none.
private static java.util.Map getContainerResolvers()
          Returns all registered container resolvers.
private static IRuntimeClasspathEntryResolver getContributedResolver(java.lang.String typeId)
          Returns the resolver registered for the given contributed classpath entry type.
static org.eclipse.jdt.core.IClasspathEntry getDefaultJREContainerEntry()
          Creates and returns a classpath entry describing the default JRE container entry.
static IVMConnector getDefaultVMConnector()
          Return the default VM connector.
private static java.lang.String getDefaultVMConnectorId()
           
private static java.lang.String getDefaultVMId()
           
static IVMInstall getDefaultVMInstall()
          Return the default VM set with setDefaultVM().
private static java.util.Map getEntryResolvers()
          Returns all registered runtime classpath entry resolvers.
private static org.eclipse.jdt.core.IJavaModel getJavaModel()
          Convenience method to get the java model.
static org.eclipse.jdt.core.IJavaProject getJavaProject(org.eclipse.debug.core.ILaunchConfiguration configuration)
          Return the IJavaProject referenced in the specified configuration or null if none.
static org.eclipse.jdt.core.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 java.lang.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.
private static IRuntimeClasspathEntryResolver getVariableResolver(java.lang.String variableName)
          Returns the resolver registered for the given variable, or null if none.
private static java.util.Map getVariableResolvers()
          Returns all registered variable resolvers.
static IVMConnector getVMConnector(java.lang.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(java.lang.String idString)
          Return the VM corrseponding to the specified composite Id.
static IVMInstall getVMInstall(org.eclipse.jdt.core.IJavaProject project)
          Returns the VM assigned to build the given Java project.
static IVMInstallType getVMInstallType(java.lang.String id)
          Returns the VM install type with the given unique id.
static IVMInstallType[] getVMInstallTypes()
          Returns the list of registered VM types.
private static java.lang.String getVMsAsXML()
           
private static void initializeProviders()
           
private static void initializeResolvers()
           
private static void initializeVMConfiguration()
          This method loads the set of installed JREs.
private static void initializeVMTypes()
           
private static void loadVMDefsIntoMemory(org.eclipse.jdt.internal.launching.VMDefinitionsContainer vmContainer)
          For each VMStandin object in the specified VM container, convert it into a 'real' VM.
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(org.eclipse.jdt.core.IJavaProject project)
          Returns a new runtime classpath entry containing the default classpath for the specified Java project.
static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(org.eclipse.jdt.core.IJavaProject project)
          Returns a new runtime classpath entry for the given project.
private static IRuntimeClasspathEntry newRuntimeClasspathEntry(org.eclipse.jdt.core.IClasspathEntry entry)
          Returns a runtime classpath entry that corresponds to the given classpath entry.
static IRuntimeClasspathEntry newRuntimeClasspathEntry(java.lang.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, org.eclipse.jdt.core.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(java.lang.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.
private static void notifyDefaultVMChanged(IVMInstall previous, IVMInstall current)
           
static void removeVMInstallChangedListener(IVMInstallChangedListener listener)
          Removes the given listener from the list of registered VM install changed listeners.
private static IRuntimeClasspathEntry[] resolveOutputLocations(org.eclipse.jdt.core.IJavaProject project, int classpathProperty)
          Returns runtime classpath entries corresponding to the output locations of the given project, or null if the project only uses the default output location.
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, org.eclipse.jdt.core.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.
private static IRuntimeClasspathEntry[] resolveVariableEntry(IRuntimeClasspathEntry entry, org.eclipse.jdt.core.IJavaProject project, org.eclipse.debug.core.ILaunchConfiguration configuration)
          Default resolution for a classpath variable - resolve to an archive.
static void savePreferences()
          Saves the preferences for the launching plug-in.
static void saveVMConfiguration()
          Saves the VM configuration information to the preferences.
private static void saveVMDefinitions(java.lang.String vmDefXML)
          Write out the specified String as the new value of the VM definitions preference and save all 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

JRELIB_VARIABLE

public static final java.lang.String JRELIB_VARIABLE
Classpath variable name used for the default JRE's library (value "JRE_LIB").

See Also:
Constant Field Values

JRESRC_VARIABLE

public static final java.lang.String JRESRC_VARIABLE
Classpath variable name used for the default JRE's library source (value "JRE_SRC").

See Also:
Constant Field Values

JRESRCROOT_VARIABLE

public static final java.lang.String JRESRCROOT_VARIABLE
Classpath variable name used for the default JRE's library source root (value "JRE_SRCROOT").

See Also:
Constant Field Values

EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS

public static final java.lang.String EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS
Simple identifier constant (value "runtimeClasspathEntryResolvers") for the runtime classpath entry resolvers extension point.

Since:
2.0
See Also:
Constant Field Values

EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS

public static final java.lang.String EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS
Simple identifier constant (value "classpathProviders") for the runtime classpath providers extension point.

Since:
2.0
See Also:
Constant Field Values

JRE_CONTAINER

public static final java.lang.String JRE_CONTAINER
Classpath container used for a project's JRE (value "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:
  1. VM Install Type Identifier - identifies the type of JRE used to build the project. For example, the standard VM.
  2. VM Install Name - a user defined name that identifies that a specific VM of the above kind. For example, IBM 1.3.1. This information is shared in a projects classpath file, so teams must agree on JRE naming conventions.

Since:
2.0

ERR_UNABLE_TO_RESOLVE_JRE

public static final int ERR_UNABLE_TO_RESOLVE_JRE
A status code indicating that a JRE could not be resolved for a project. When a JRE cannot be resolved for a project by this plug-in's container initializer, an exception is thrown with this status code. A status handler may be registered for this status code. The 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.

Since:
2.0
See Also:
Constant Field Values

PREF_CONNECT_TIMEOUT

public static final java.lang.String PREF_CONNECT_TIMEOUT
Preference key for launch/connect timeout. VM Runners should honor this timeout value when attempting to launch and connect to a debuggable VM. The value is an int, indicating a number of milliseconds.

Since:
2.0

PREF_VM_XML

public static final java.lang.String PREF_VM_XML
Preference key for the String of XML that defines all installed VMs.

Since:
2.1

DEF_CONNECT_TIMEOUT

public static final int DEF_CONNECT_TIMEOUT
Default launch/connect timeout (ms).

Since:
2.0
See Also:
Constant Field Values

ATTR_CMDLINE

public static final java.lang.String ATTR_CMDLINE
Deprecated. - use IProcess.ATTR_CMDLINE

Attribute key for a process property. The class 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.


fgVMTypes

private static IVMInstallType[] fgVMTypes

fgDefaultVMId

private static java.lang.String fgDefaultVMId

fgDefaultVMConnectorId

private static java.lang.String fgDefaultVMConnectorId

fgVariableResolvers

private static java.util.Map fgVariableResolvers
Resolvers keyed by variable name, container id, and runtime classpath entry id.


fgContainerResolvers

private static java.util.Map fgContainerResolvers

fgRuntimeClasspathEntryResolvers

private static java.util.Map fgRuntimeClasspathEntryResolvers

fgPathProviders

private static java.util.Map fgPathProviders
Path providers keyed by id


fgDefaultClasspathProvider

private static IRuntimeClasspathProvider fgDefaultClasspathProvider
Default classpath and source path providers.


fgDefaultSourcePathProvider

private static IRuntimeClasspathProvider fgDefaultSourcePathProvider

fgVMListeners

private static org.eclipse.jdt.internal.launching.ListenerList fgVMListeners
VM change listeners

Constructor Detail

JavaRuntime

private JavaRuntime()
This class contains only static methods, and is not intended to be instantiated.

Method Detail

initializeVMTypes

private static void initializeVMTypes()

getVMInstall

public static IVMInstall getVMInstall(org.eclipse.jdt.core.IJavaProject project)
                               throws org.eclipse.core.runtime.CoreException
Returns the VM assigned to build the given Java project. The project must exist. The VM assigned to a project is determined from its build path.


getVMInstallType

public static IVMInstallType getVMInstallType(java.lang.String id)
Returns the VM install type with the given unique id.


setDefaultVMInstall

public static void setDefaultVMInstall(IVMInstall vm,
                                       org.eclipse.core.runtime.IProgressMonitor monitor)
                                throws org.eclipse.core.runtime.CoreException
Sets a VM as the system-wide default VM, and notifies registered VM install change listeners of the change.


setDefaultVMInstall

public static void setDefaultVMInstall(IVMInstall vm,
                                       org.eclipse.core.runtime.IProgressMonitor monitor,
                                       boolean savePreference)
                                throws org.eclipse.core.runtime.CoreException
Sets a VM as the system-wide default VM, and notifies registered VM install change listeners of the change.

Since:
2.1

setDefaultVMConnector

public static void setDefaultVMConnector(IVMConnector connector,
                                         org.eclipse.core.runtime.IProgressMonitor monitor)
                                  throws org.eclipse.core.runtime.CoreException
Sets a VM connector as the system-wide default VM. This setting is persisted when saveVMConfiguration is called.

Since:
2.0

getDefaultVMInstall

public static IVMInstall getDefaultVMInstall()
Return the default VM set with setDefaultVM().


getDefaultVMConnector

public static IVMConnector getDefaultVMConnector()
Return the default VM connector.

Since:
2.0

getVMInstallTypes

public static IVMInstallType[] getVMInstallTypes()
Returns the list of registered VM types. VM types are registered via "org.eclipse.jdt.launching.vmTypes" extension point. Returns an empty list if there are no registered VM types.


getDefaultVMId

private static java.lang.String getDefaultVMId()

getDefaultVMConnectorId

private static java.lang.String getDefaultVMConnectorId()

getCompositeIdFromVM

public static java.lang.String getCompositeIdFromVM(IVMInstall vm)
Returns a String that uniquely identifies the specified VM across all VM types.

Since:
2.1

getVMFromCompositeId

public static IVMInstall getVMFromCompositeId(java.lang.String idString)
Return the VM corrseponding to the specified composite Id. The id uniquely identifies a VM across all vm types.

Since:
2.1

newStringVariableClasspathEntry

public static IRuntimeClasspathEntry newStringVariableClasspathEntry(java.lang.String expression)
Returns a new runtime classpath entry for the given expression that may contain string substitution variable references. The resulting expression refers to an archive (jar or directory) containing class files.

Since:
3.0

newDefaultProjectClasspathEntry

public static IRuntimeClasspathEntry newDefaultProjectClasspathEntry(org.eclipse.jdt.core.IJavaProject project)
Returns a new runtime classpath entry containing the default classpath for the specified Java project.

Since:
3.0

newProjectRuntimeClasspathEntry

public static IRuntimeClasspathEntry newProjectRuntimeClasspathEntry(org.eclipse.jdt.core.IJavaProject project)
Returns a new runtime classpath entry for the given project.

Since:
2.0

newArchiveRuntimeClasspathEntry

public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.resources.IResource resource)
Returns a new runtime classpath entry for the given archive.

Since:
2.0

newArchiveRuntimeClasspathEntry

public static IRuntimeClasspathEntry newArchiveRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path)
Returns a new runtime classpath entry for the given archive (possibly external).

Since:
2.0

newVariableRuntimeClasspathEntry

public static IRuntimeClasspathEntry newVariableRuntimeClasspathEntry(org.eclipse.core.runtime.IPath path)
Returns a new runtime classpath entry for the classpath variable with the given path.

Since:
2.0

newRuntimeContainerClasspathEntry

public static IRuntimeClasspathEntry newRuntimeContainerClasspathEntry(org.eclipse.core.runtime.IPath path,
                                                                       int classpathProperty)
                                                                throws org.eclipse.core.runtime.CoreException
Returns a runtime classpath entry for the given container path with the given classpath property.

Since:
2.0

newRuntimeContainerClasspathEntry

public static IRuntimeClasspathEntry newRuntimeContainerClasspathEntry(org.eclipse.core.runtime.IPath path,
                                                                       int classpathProperty,
                                                                       org.eclipse.jdt.core.IJavaProject project)
                                                                throws org.eclipse.core.runtime.CoreException
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.

Since:
3.0

newRuntimeClasspathEntry

public static IRuntimeClasspathEntry newRuntimeClasspathEntry(java.lang.String memento)
                                                       throws org.eclipse.core.runtime.CoreException
Returns a runtime classpath entry constructed from the given memento.

Since:
2.0

newRuntimeClasspathEntry

private static IRuntimeClasspathEntry newRuntimeClasspathEntry(org.eclipse.jdt.core.IClasspathEntry entry)
Returns a runtime classpath entry that corresponds to the given classpath entry. The classpath entry may not be of type CPE_SOURCE or CPE_CONTAINER.

Since:
2.0

computeUnresolvedRuntimeClasspath

public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(org.eclipse.jdt.core.IJavaProject project)
                                                                  throws org.eclipse.core.runtime.CoreException
Computes and returns the default unresolved runtime claspath for the given project.

Since:
2.0

computeUnresolvedSourceLookupPath

public static IRuntimeClasspathEntry[] computeUnresolvedSourceLookupPath(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                                  throws org.eclipse.core.runtime.CoreException
Computes and returns the unresolved source lookup path for the given launch configuration.

Since:
2.0

resolveSourceLookupPath

public static IRuntimeClasspathEntry[] resolveSourceLookupPath(IRuntimeClasspathEntry[] entries,
                                                               org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                        throws org.eclipse.core.runtime.CoreException
Resolves the given source lookup path, returning the resolved source lookup path in the context of the given launch configuration.

Since:
2.0

getClasspathProvider

public static IRuntimeClasspathProvider getClasspathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                      throws org.eclipse.core.runtime.CoreException
Returns the classpath provider for the given launch configuration.

Since:
2.0

getSourceLookupPathProvider

public static IRuntimeClasspathProvider getSourceLookupPathProvider(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                             throws org.eclipse.core.runtime.CoreException
Returns the source lookup path provider for the given launch configuration.

Since:
2.0

resolveRuntimeClasspathEntry

public static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry,
                                                                    org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                             throws org.eclipse.core.runtime.CoreException
Returns resolved entries for the given entry in the context of the given launch configuration. If the entry is of kind 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.

Since:
2.0

resolveVariableEntry

private static IRuntimeClasspathEntry[] resolveVariableEntry(IRuntimeClasspathEntry entry,
                                                             org.eclipse.jdt.core.IJavaProject project,
                                                             org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                      throws org.eclipse.core.runtime.CoreException
Default resolution for a classpath variable - resolve to an archive. Only one of project/configuration can be non-null.


resolveOutputLocations

private static IRuntimeClasspathEntry[] resolveOutputLocations(org.eclipse.jdt.core.IJavaProject project,
                                                               int classpathProperty)
                                                        throws org.eclipse.core.runtime.CoreException
Returns runtime classpath entries corresponding to the output locations of the given project, or null if the project only uses the default output location.


resolveRuntimeClasspathEntry

public static IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry(IRuntimeClasspathEntry entry,
                                                                    org.eclipse.jdt.core.IJavaProject project)
                                                             throws org.eclipse.core.runtime.CoreException
Returns resolved entries for the given entry in the context of the given Java project. If the entry is of kind 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.

Since:
2.0

computeDefaultContainerEntries

private static IRuntimeClasspathEntry[] computeDefaultContainerEntries(IRuntimeClasspathEntry entry,
                                                                       org.eclipse.debug.core.ILaunchConfiguration config)
                                                                throws org.eclipse.core.runtime.CoreException
Performs default resolution for a container entry. Delegates to the Java model.


computeDefaultContainerEntries

private static IRuntimeClasspathEntry[] computeDefaultContainerEntries(IRuntimeClasspathEntry entry,
                                                                       org.eclipse.jdt.core.IJavaProject project)
                                                                throws org.eclipse.core.runtime.CoreException
Performs default resolution for a container entry. Delegates to the Java model.


computeUnresolvedRuntimeClasspath

public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                                  throws org.eclipse.core.runtime.CoreException
Computes and returns the unresolved class path for the given launch configuration. Variable and container entries are unresolved.

Since:
2.0

resolveRuntimeClasspath

public static IRuntimeClasspathEntry[] resolveRuntimeClasspath(IRuntimeClasspathEntry[] entries,
                                                               org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                        throws org.eclipse.core.runtime.CoreException
Resolves the given classpath, returning the resolved classpath in the context of the given launch configuration.

Since:
2.0

getJavaProject

public static org.eclipse.jdt.core.IJavaProject getJavaProject(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                                        throws org.eclipse.core.runtime.CoreException
Return the IJavaProject referenced in the specified configuration or null if none.

Since:
2.0

getJavaModel

private static org.eclipse.jdt.core.IJavaModel getJavaModel()
Convenience method to get the java model.


computeVMInstall

public static IVMInstall computeVMInstall(org.eclipse.debug.core.ILaunchConfiguration configuration)
                                   throws org.eclipse.core.runtime.CoreException
Returns the VM install for the given launch configuration. The VM install is determined in the following prioritized way:
  1. The VM install is explicitly specified on the launch configuration via the ATTR_VM_INSTALL_TYPE and ATTR_VM_INSTALL_ID attributes.
  2. If no explicit VM install is specified, the VM install associated with the launch confiugration's project is returned.
  3. If no project is specified, or the project does not specify a custom VM install, the workspace default VM install is returned.

Since:
2.0

abort

private static void abort(java.lang.String message,
                          java.lang.Throwable exception)
                   throws org.eclipse.core.runtime.CoreException
Throws a core exception with an internal error status.


abort

private static void abort(java.lang.String message,
                          int code,
                          java.lang.Throwable exception)
                   throws org.eclipse.core.runtime.CoreException
Throws a core exception with an internal error status.


computeDefaultRuntimeClassPath

public static java.lang.String[] computeDefaultRuntimeClassPath(org.eclipse.jdt.core.IJavaProject jproject)
                                                         throws org.eclipse.core.runtime.CoreException
Computes the default application classpath entries for the given project.


saveVMConfiguration

public static void saveVMConfiguration()
                                throws org.eclipse.core.runtime.CoreException
Saves the VM configuration information to the preferences. This includes the following information:
  • The list of all defined IVMInstall instances.
  • The default VM
    • This state will be read again upon first access to VM configuration information.


saveVMDefinitions

private static void saveVMDefinitions(java.lang.String vmDefXML)
Write out the specified String as the new value of the VM definitions preference and save all preferences.


getVMsAsXML

private static java.lang.String getVMsAsXML()
                                     throws java.io.IOException,
                                            javax.xml.parsers.ParserConfigurationException,
                                            javax.xml.transform.TransformerException

initializeVMConfiguration

private static void initializeVMConfiguration()
                                       throws javax.xml.parsers.ParserConfigurationException,
                                              java.io.IOException,
                                              javax.xml.transform.TransformerException
This method loads the set of installed JREs. This definition is stored in the workbench preferences, however older workspaces may store this information in a meta-data file. In both cases, the VMs are described as an XML document. If neither the preference nor the meta-data file is found, the file system is searched for VMs.


loadVMDefsIntoMemory

private static void loadVMDefsIntoMemory(org.eclipse.jdt.internal.launching.VMDefinitionsContainer vmContainer)
For each VMStandin object in the specified VM container, convert it into a 'real' VM.


getLibraryLocations

public static LibraryLocation[] getLibraryLocations(IVMInstall vm)
Evaluates library locations for a IVMInstall. If no library locations are set on the install, a default location is evaluated and checked if it exists.

Since:
2.0

detectEclipseRuntime

private static VMStandin detectEclipseRuntime()
Detect the VM that Eclipse is running on.


detectDefaultVM

private static void detectDefaultVM()
Tries to locate a default VM (if one is not currently set). Sets the default VM to be the Eclipse runtime or the first VM found. Log an error with the workspace if a no VMs can be located.


detectAndSaveVMDefinitions

private static void detectAndSaveVMDefinitions()
Detects VM installations, and a default VM (if required). Saves the results.


generateDetectedVMName

private static java.lang.String generateDetectedVMName(IVMInstall vm)
Make the name of a detected VM stand out.


getJREVariableEntry

public static org.eclipse.jdt.core.IClasspathEntry getJREVariableEntry()
Creates and returns a classpath entry describing the JRE_LIB classpath variable.


getDefaultJREContainerEntry

public static org.eclipse.jdt.core.IClasspathEntry getDefaultJREContainerEntry()
Creates and returns a classpath entry describing the default JRE container entry.

Since:
2.0

getVMConnector

public static IVMConnector getVMConnector(java.lang.String id)
Returns the VM connector defined with the specified identifier, or null if none.

Since:
2.0

getVMConnectors

public static IVMConnector[] getVMConnectors()
Returns all VM connector extensions.

Since:
2.0

getPreferences

public static org.eclipse.core.runtime.Preferences getPreferences()
Returns the preference store for the launching plug-in.

Since:
2.0

savePreferences

public static void savePreferences()
Saves the preferences for the launching plug-in.

Since:
2.0

addVariableResolver

public static void addVariableResolver(IRuntimeClasspathEntryResolver resolver,
                                       java.lang.String variableName)
Registers the given resolver for the specified variable.

Since:
2.0

addContainerResolver

public static void addContainerResolver(IRuntimeClasspathEntryResolver resolver,
                                        java.lang.String containerIdentifier)
Registers the given resolver for the specified container.

Since:
2.0

getVariableResolvers

private static java.util.Map getVariableResolvers()
Returns all registered variable resolvers.


getContainerResolvers

private static java.util.Map getContainerResolvers()
Returns all registered container resolvers.


getEntryResolvers

private static java.util.Map getEntryResolvers()
Returns all registered runtime classpath entry resolvers.


initializeResolvers

private static void initializeResolvers()

getClasspathProviders

private static java.util.Map getClasspathProviders()
Returns all registered classpath providers.


initializeProviders

private static void initializeProviders()

getVariableResolver

private static IRuntimeClasspathEntryResolver getVariableResolver(java.lang.String variableName)
Returns the resolver registered for the given variable, or null if none.


getContainerResolver

private static IRuntimeClasspathEntryResolver getContainerResolver(java.lang.String containerId)
Returns the resolver registered for the given container id, or null if none.


getContributedResolver

private static IRuntimeClasspathEntryResolver getContributedResolver(java.lang.String typeId)
Returns the resolver registered for the given contributed classpath entry type.


addVMInstallChangedListener

public static void addVMInstallChangedListener(IVMInstallChangedListener listener)
Adds the given listener to the list of registered VM install changed listeners. Has no effect if an identical listener is already registered.

Since:
2.0

removeVMInstallChangedListener

public static void removeVMInstallChangedListener(IVMInstallChangedListener listener)
Removes the given listener from the list of registered VM install changed listeners. Has no effect if an identical listener is not already registered.

Since:
2.0

notifyDefaultVMChanged

private static void notifyDefaultVMChanged(IVMInstall previous,
                                           IVMInstall current)

fireVMChanged

public static void fireVMChanged(PropertyChangeEvent event)
Notifies all VM install changed listeners of the given property change.

Since:
2.0

fireVMAdded

public static void fireVMAdded(IVMInstall vm)
Notifies all VM install changed listeners of the VM addition

Since:
2.0

fireVMRemoved

public static void fireVMRemoved(IVMInstall vm)
Notifies all VM install changed listeners of the VM removal

Since:
2.0

getProjectOutputDirectory

public static java.lang.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.

Since:
2.1