Eclipse JDT
2.0

org.eclipse.jdt.launching.sourcelookup
Class JavaSourceLocator

java.lang.Object
  |
  +--org.eclipse.jdt.launching.sourcelookup.JavaSourceLocator
All Implemented Interfaces:
IPersistableSourceLocator, ISourceLocator

public class JavaSourceLocator
extends Object
implements IPersistableSourceLocator

Locates source for a Java debug session by searching a configurable set of source locations.

This class may be instantiated; it is not intended to be subclassed.

Since:
2.0
See Also:
ISourceLocator

Field Summary
static String ID_JAVA_SOURCE_LOCATOR
          Identifier for the 'Java Source Locator' extension (value "org.eclipse.jdt.launching.javaSourceLocator").
 
Constructor Summary
JavaSourceLocator()
          Constructs a new empty JavaSourceLocator.
JavaSourceLocator(IJavaProject project)
          Constructs a new JavaSourceLocator that searches the default set of source locations for the given Java project.
JavaSourceLocator(IJavaProject[] projects, boolean includeRequired)
          Constructs a new Java source locator that looks in the specified project for source, and required projects, if includeRequired is true.
JavaSourceLocator(IJavaSourceLocation[] locations)
          Constructs a new JavaSourceLocator that searches the specified set of source locations for source elements.
 
Method Summary
protected static void collectRequiredProjects(IJavaProject proj, ArrayList res)
          Adds all projects required by proj to the list res
static IJavaSourceLocation[] getDefaultSourceLocations(IJavaProject project)
          Returns a default collection of source locations for the given Java project.
 String getMemento()
           
 Object getSourceElement(IStackFrame stackFrame)
           
 IJavaSourceLocation[] getSourceLocations()
          Returns the locations that this source locator is currently searching, in the order that they are searched.
 void initializeDefaults(ILaunchConfiguration configuration)
           
 void initializeFromMemento(String memento)
           
 void setSourceLocations(IJavaSourceLocation[] locations)
          Sets the locations that will be searched, in the order to be searched.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_JAVA_SOURCE_LOCATOR

public static final String ID_JAVA_SOURCE_LOCATOR
Identifier for the 'Java Source Locator' extension (value "org.eclipse.jdt.launching.javaSourceLocator").

Constructor Detail

JavaSourceLocator

public JavaSourceLocator()
Constructs a new empty JavaSourceLocator.


JavaSourceLocator

public JavaSourceLocator(IJavaProject[] projects,
                         boolean includeRequired)
                  throws JavaModelException
Constructs a new Java source locator that looks in the specified project for source, and required projects, if includeRequired is true.

Parameters:
projects - the projects in which to look for source
includeRequired - whether to look in required projects as well

JavaSourceLocator

public JavaSourceLocator(IJavaSourceLocation[] locations)
Constructs a new JavaSourceLocator that searches the specified set of source locations for source elements.

Parameters:
locations - the source locations to search for source, in the order they should be searched

JavaSourceLocator

public JavaSourceLocator(IJavaProject project)
                  throws CoreException
Constructs a new JavaSourceLocator that searches the default set of source locations for the given Java project.

Parameters:
project - Java project
Throws:
CoreException - if an exception occurs reading the classpath of the given or any required project
Method Detail

setSourceLocations

public void setSourceLocations(IJavaSourceLocation[] locations)
Sets the locations that will be searched, in the order to be searched.

Parameters:
locations - the locations that will be searched, in the order to be searched

getSourceLocations

public IJavaSourceLocation[] getSourceLocations()
Returns the locations that this source locator is currently searching, in the order that they are searched.

Returns:
the locations that this source locator is currently searching, in the order that they are searched

getSourceElement

public Object getSourceElement(IStackFrame stackFrame)
Specified by:
getSourceElement in interface ISourceLocator
See Also:
ISourceLocator.getSourceElement(IStackFrame)

collectRequiredProjects

protected static void collectRequiredProjects(IJavaProject proj,
                                              ArrayList res)
                                       throws JavaModelException
Adds all projects required by proj to the list res

Parameters:
proj - the project for which to compute required projects
res - the list to add all required projects too
JavaModelException

getDefaultSourceLocations

public static IJavaSourceLocation[] getDefaultSourceLocations(IJavaProject project)
                                                       throws CoreException
Returns a default collection of source locations for the given Java project. Default source locations consist of the given project and all of its required projects .

Parameters:
project - Java project
Returns:
a collection of source locations for all required projects
Throws:
CoreException - if an exception occurs reading the classpath of the given or any required project

getMemento

public String getMemento()
                  throws CoreException
Specified by:
getMemento in interface IPersistableSourceLocator
CoreException
See Also:
IPersistableSourceLocator.getMemento()

initializeDefaults

public void initializeDefaults(ILaunchConfiguration configuration)
                        throws CoreException
Specified by:
initializeDefaults in interface IPersistableSourceLocator
CoreException
See Also:
IPersistableSourceLocator.initializeDefaults(ILaunchConfiguration)

initializeFromMemento

public void initializeFromMemento(String memento)
                           throws CoreException
Specified by:
initializeFromMemento in interface IPersistableSourceLocator
CoreException
See Also:
IPersistableSourceLocator.initializeFromMemento(String)

Eclipse JDT
2.0

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