Eclipse JDT
2.0

org.eclipse.jdt.launching.sourcelookup
Class JavaProjectSourceLocation

java.lang.Object
  |
  +--org.eclipse.core.runtime.PlatformObject
        |
        +--org.eclipse.jdt.launching.sourcelookup.JavaProjectSourceLocation
All Implemented Interfaces:
IAdaptable, IJavaSourceLocation

public class JavaProjectSourceLocation
extends PlatformObject
implements IJavaSourceLocation

Locates source elements in a Java project. Returns instances of ICompilationUnit and IClassFile.

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

Since:
2.0
See Also:
IJavaSourceLocation

Constructor Summary
JavaProjectSourceLocation()
          Constructs a new empty source location to be initialized by a memento.
JavaProjectSourceLocation(IJavaProject project)
          Constructs a new source location that will retrieve source elements from the given Java project.
 
Method Summary
 boolean equals(Object object)
           
 Object findSourceElement(String name)
          Returns an object representing the source code for a type with the specified name, or null if none could be found.
 IJavaProject getJavaProject()
          Returns the Java project associated with this source location.
 String getMemento()
          Returns a memento for this source location from which this source location can be reconstructed.
 int hashCode()
           
 void initializeFrom(String memento)
          Initializes this source location from the given memento.
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

JavaProjectSourceLocation

public JavaProjectSourceLocation()
Constructs a new empty source location to be initialized by a memento.


JavaProjectSourceLocation

public JavaProjectSourceLocation(IJavaProject project)
Constructs a new source location that will retrieve source elements from the given Java project.

Parameters:
project - Java project
Method Detail

findSourceElement

public Object findSourceElement(String name)
                         throws CoreException
Description copied from interface: IJavaSourceLocation
Returns an object representing the source code for a type with the specified name, or null if none could be found. The name is a fully qualified type name, and may contain the '$' character when referring to inner types. For example, java.lang.String. The source element returned is implementation specific - for example, a resource, a local file, a zip file entry, etc.

Specified by:
findSourceElement in interface IJavaSourceLocation
Parameters:
name - fully qualified name of the type for which source is being searched for
Returns:
source element
Throws:
CoreException - if an exception occurs while searching for the specified source element
See Also:
IJavaSourceLocation.findSourceElement(String)

getJavaProject

public IJavaProject getJavaProject()
Returns the Java project associated with this source location.

Returns:
Java project

equals

public boolean equals(Object object)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getMemento

public String getMemento()
                  throws CoreException
Description copied from interface: IJavaSourceLocation
Returns a memento for this source location from which this source location can be reconstructed.

Specified by:
getMemento in interface IJavaSourceLocation
Returns:
a memento for this source location
Throws:
CoreException - if unable to create a memento
See Also:
IJavaSourceLocation.getMemento()

initializeFrom

public void initializeFrom(String memento)
                    throws CoreException
Description copied from interface: IJavaSourceLocation
Initializes this source location from the given memento.

Specified by:
initializeFrom in interface IJavaSourceLocation
Parameters:
memento - a memento generated by this source location
Throws:
CoreException - if unable to initialize this source location
See Also:
IJavaSourceLocation.initializeFrom(String)

Eclipse JDT
2.0

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