org.eclipse.cdt.debug.internal.core.sourcelookup
Class CSourceLocator

java.lang.Object
  extended by org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator
All Implemented Interfaces:
java.util.EventListener, ICSourceLocator, org.eclipse.core.resources.IResourceChangeListener, org.eclipse.debug.core.model.IPersistableSourceLocator, org.eclipse.debug.core.model.ISourceLocator

public class CSourceLocator
extends java.lang.Object
implements ICSourceLocator, org.eclipse.debug.core.model.IPersistableSourceLocator, org.eclipse.core.resources.IResourceChangeListener

Default source locator.


Constructor Summary
CSourceLocator(org.eclipse.core.resources.IProject project)
          Constructor for CSourceLocator.
 
Method Summary
 boolean contains(org.eclipse.core.resources.IResource resource)
          Returns whether this locator is able to locate the given resource.
 java.lang.Object findSourceElement(java.lang.String fileName)
          Returns an object representing the source code for a type with the specified name, or null if none could be found.
static ICSourceLocation[] getDefaultSourceLocations(org.eclipse.core.resources.IProject project)
          Returns a default collection of source locations for the given project.
 int getLineNumber(org.eclipse.debug.core.model.IStackFrame frame)
          Returns the line number of the instruction pointer in the specified stack frame that corresponds to a line in an associated source element, or -1 if line number information is unavailable.
 java.lang.String getMemento()
           
 org.eclipse.core.resources.IProject getProject()
          Returns the project this source locator is associated with or null.
 java.lang.Object getSourceElement(org.eclipse.debug.core.model.IStackFrame stackFrame)
           
 ICSourceLocation[] getSourceLocations()
          Returns the source locations of this locator.
 void initializeDefaults(org.eclipse.debug.core.ILaunchConfiguration configuration)
           
 void initializeFromMemento(java.lang.String memento)
           
 void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
           
 boolean searchForDuplicateFiles()
          Returns whether to search for all source elements, or just the first match.
 void setSearchForDuplicateFiles(boolean search)
          Sets the value of the 'search for duplicate source files' flag.
 void setSourceLocations(ICSourceLocation[] locations)
          Sets the source locations of this locator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSourceLocator

public CSourceLocator(org.eclipse.core.resources.IProject project)
Constructor for CSourceLocator.

Method Detail

getSourceElement

public java.lang.Object getSourceElement(org.eclipse.debug.core.model.IStackFrame stackFrame)
Specified by:
getSourceElement in interface org.eclipse.debug.core.model.ISourceLocator

getLineNumber

public int getLineNumber(org.eclipse.debug.core.model.IStackFrame frame)
Description copied from interface: ICSourceLocator
Returns the line number of the instruction pointer in the specified stack frame that corresponds to a line in an associated source element, or -1 if line number information is unavailable.

Specified by:
getLineNumber in interface ICSourceLocator
Returns:
line number of instruction pointer in this stack frame, or -1 if line number information is unavailable

contains

public boolean contains(org.eclipse.core.resources.IResource resource)
Description copied from interface: ICSourceLocator
Returns whether this locator is able to locate the given resource.

Specified by:
contains in interface ICSourceLocator
Parameters:
resource - the resource to locate
Returns:
whether this locator is able to locate the given resource

getSourceLocations

public ICSourceLocation[] getSourceLocations()
Description copied from interface: ICSourceLocator
Returns the source locations of this locator.

Specified by:
getSourceLocations in interface ICSourceLocator
Returns:
the source locations of this locator

setSourceLocations

public void setSourceLocations(ICSourceLocation[] locations)
Description copied from interface: ICSourceLocator
Sets the source locations of this locator.

Specified by:
setSourceLocations in interface ICSourceLocator

getDefaultSourceLocations

public static ICSourceLocation[] getDefaultSourceLocations(org.eclipse.core.resources.IProject project)
Returns a default collection of source locations for the given project. Default source locations consist of the given project and all of its referenced projects.

Parameters:
project - a project
Returns:
a collection of source locations for all required projects
Throws:
org.eclipse.core.runtime.CoreException

findSourceElement

public java.lang.Object findSourceElement(java.lang.String fileName)
Description copied from interface: ICSourceLocator
Returns an object representing the source code for a type with the specified name, or null if none could be found. The source element returned is implementation specific - for example, a resource, a local file, a zip file entry, etc.

Specified by:
findSourceElement in interface ICSourceLocator
Returns:
source element

getMemento

public java.lang.String getMemento()
                            throws org.eclipse.core.runtime.CoreException
Specified by:
getMemento in interface org.eclipse.debug.core.model.IPersistableSourceLocator
Throws:
org.eclipse.core.runtime.CoreException

initializeDefaults

public void initializeDefaults(org.eclipse.debug.core.ILaunchConfiguration configuration)
                        throws org.eclipse.core.runtime.CoreException
Specified by:
initializeDefaults in interface org.eclipse.debug.core.model.IPersistableSourceLocator
Throws:
org.eclipse.core.runtime.CoreException

initializeFromMemento

public void initializeFromMemento(java.lang.String memento)
                           throws org.eclipse.core.runtime.CoreException
Specified by:
initializeFromMemento in interface org.eclipse.debug.core.model.IPersistableSourceLocator
Throws:
org.eclipse.core.runtime.CoreException

resourceChanged

public void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
Specified by:
resourceChanged in interface org.eclipse.core.resources.IResourceChangeListener

getProject

public org.eclipse.core.resources.IProject getProject()
Description copied from interface: ICSourceLocator
Returns the project this source locator is associated with or null.

Specified by:
getProject in interface ICSourceLocator
Returns:
project this source locator is associated with or null

searchForDuplicateFiles

public boolean searchForDuplicateFiles()
Description copied from interface: ICSourceLocator
Returns whether to search for all source elements, or just the first match.

Specified by:
searchForDuplicateFiles in interface ICSourceLocator
Returns:
whether to search for all source elements, or just the first match

setSearchForDuplicateFiles

public void setSearchForDuplicateFiles(boolean search)
Description copied from interface: ICSourceLocator
Sets the value of the 'search for duplicate source files' flag.

Specified by:
setSearchForDuplicateFiles in interface ICSourceLocator
Parameters:
search - - a value to set