mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Implementation of source locator.
This commit is contained in:
parent
fc3bcd32fe
commit
192446dcfa
4 changed files with 51 additions and 7 deletions
|
@ -127,7 +127,8 @@ public class CProjectSourceLocation implements ICSourceLocation
|
|||
|
||||
private Object findFileByRelativePath( String fileName )
|
||||
{
|
||||
return getProject().getFile( fileName );
|
||||
IPath path = getProject().getLocation().append( fileName );
|
||||
return getProject().findMember( path );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,8 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
import org.eclipse.debug.core.model.IPersistableSourceLocator;
|
||||
import org.eclipse.debug.core.model.IStackFrame;
|
||||
|
||||
/**
|
||||
|
@ -28,7 +30,7 @@ import org.eclipse.debug.core.model.IStackFrame;
|
|||
*
|
||||
* @since Aug 19, 2002
|
||||
*/
|
||||
public class CSourceLocator implements ICSourceLocator
|
||||
public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocator
|
||||
{
|
||||
/**
|
||||
* The array of source locations associated with this locator.
|
||||
|
@ -42,6 +44,14 @@ public class CSourceLocator implements ICSourceLocator
|
|||
|
||||
private int fInternalMode = MODE_SOURCE;
|
||||
|
||||
/**
|
||||
* Constructor for CSourceLocator.
|
||||
*/
|
||||
public CSourceLocator()
|
||||
{
|
||||
setSourceLocations( new ICSourceLocation[0] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CSourceLocator.
|
||||
*/
|
||||
|
@ -282,4 +292,26 @@ public class CSourceLocator implements ICSourceLocator
|
|||
}
|
||||
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#getMemento()
|
||||
*/
|
||||
public String getMemento() throws CoreException
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#initializeDefaults(ILaunchConfiguration)
|
||||
*/
|
||||
public void initializeDefaults( ILaunchConfiguration configuration ) throws CoreException
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.debug.core.model.IPersistableSourceLocator#initializeFromMemento(String)
|
||||
*/
|
||||
public void initializeFromMemento( String memento ) throws CoreException
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -214,9 +214,8 @@ public class CDebugTarget extends CDebugElement
|
|||
setCDITarget( cdiTarget );
|
||||
setBreakpoints( new HashMap( 5 ) );
|
||||
setTemporaryBreakpoints( new ArrayList() );
|
||||
// Temporary
|
||||
getLaunch().setSourceLocator( createSourceLocator( project ) );
|
||||
|
||||
if ( getLaunch().getSourceLocator() == null )
|
||||
getLaunch().setSourceLocator( createSourceLocator( project ) );
|
||||
setConfiguration( cdiTarget.getSession().getConfiguration() );
|
||||
fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate();
|
||||
fSupportsDisconnect = allowsDisconnect & getConfiguration().supportsDisconnect();
|
||||
|
|
|
@ -46,7 +46,7 @@ public class CUISourceLocator implements IPersistableSourceLocator
|
|||
/**
|
||||
* The project being debugged.
|
||||
*/
|
||||
private IProject fProject;
|
||||
private IProject fProject = null;
|
||||
|
||||
/**
|
||||
* Underlying source locator.
|
||||
|
@ -60,6 +60,16 @@ public class CUISourceLocator implements IPersistableSourceLocator
|
|||
*/
|
||||
private boolean fAllowedToAsk;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor for CUISourceLocator.
|
||||
*/
|
||||
public CUISourceLocator()
|
||||
{
|
||||
fSourceLocator = new CSourceLocator();
|
||||
fAllowedToAsk = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for CUISourceLocator.
|
||||
*/
|
||||
|
@ -75,7 +85,7 @@ public class CUISourceLocator implements IPersistableSourceLocator
|
|||
*/
|
||||
public String getMemento() throws CoreException
|
||||
{
|
||||
return null;
|
||||
return fSourceLocator.getMemento();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -83,6 +93,7 @@ public class CUISourceLocator implements IPersistableSourceLocator
|
|||
*/
|
||||
public void initializeFromMemento( String memento ) throws CoreException
|
||||
{
|
||||
fSourceLocator.initializeFromMemento( memento );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -90,6 +101,7 @@ public class CUISourceLocator implements IPersistableSourceLocator
|
|||
*/
|
||||
public void initializeDefaults( ILaunchConfiguration configuration ) throws CoreException
|
||||
{
|
||||
fSourceLocator.initializeDefaults( configuration );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
Loading…
Add table
Reference in a new issue