1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Implementation of source locator.

This commit is contained in:
Mikhail Khodjaiants 2002-09-24 20:18:28 +00:00
parent fc3bcd32fe
commit 192446dcfa
4 changed files with 51 additions and 7 deletions

View file

@ -127,7 +127,8 @@ public class CProjectSourceLocation implements ICSourceLocation
private Object findFileByRelativePath( String fileName ) private Object findFileByRelativePath( String fileName )
{ {
return getProject().getFile( fileName ); IPath path = getProject().getLocation().append( fileName );
return getProject().findMember( path );
} }
/** /**

View file

@ -20,6 +20,8 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.DebugException; 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; import org.eclipse.debug.core.model.IStackFrame;
/** /**
@ -28,7 +30,7 @@ import org.eclipse.debug.core.model.IStackFrame;
* *
* @since Aug 19, 2002 * @since Aug 19, 2002
*/ */
public class CSourceLocator implements ICSourceLocator public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocator
{ {
/** /**
* The array of source locations associated with this locator. * The array of source locations associated with this locator.
@ -42,6 +44,14 @@ public class CSourceLocator implements ICSourceLocator
private int fInternalMode = MODE_SOURCE; private int fInternalMode = MODE_SOURCE;
/**
* Constructor for CSourceLocator.
*/
public CSourceLocator()
{
setSourceLocations( new ICSourceLocation[0] );
}
/** /**
* Constructor for CSourceLocator. * Constructor for CSourceLocator.
*/ */
@ -282,4 +292,26 @@ public class CSourceLocator implements ICSourceLocator
} }
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] ); 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
{
}
} }

View file

@ -214,9 +214,8 @@ public class CDebugTarget extends CDebugElement
setCDITarget( cdiTarget ); setCDITarget( cdiTarget );
setBreakpoints( new HashMap( 5 ) ); setBreakpoints( new HashMap( 5 ) );
setTemporaryBreakpoints( new ArrayList() ); setTemporaryBreakpoints( new ArrayList() );
// Temporary if ( getLaunch().getSourceLocator() == null )
getLaunch().setSourceLocator( createSourceLocator( project ) ); getLaunch().setSourceLocator( createSourceLocator( project ) );
setConfiguration( cdiTarget.getSession().getConfiguration() ); setConfiguration( cdiTarget.getSession().getConfiguration() );
fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate(); fSupportsTerminate = allowsTerminate & getConfiguration().supportsTerminate();
fSupportsDisconnect = allowsDisconnect & getConfiguration().supportsDisconnect(); fSupportsDisconnect = allowsDisconnect & getConfiguration().supportsDisconnect();

View file

@ -46,7 +46,7 @@ public class CUISourceLocator implements IPersistableSourceLocator
/** /**
* The project being debugged. * The project being debugged.
*/ */
private IProject fProject; private IProject fProject = null;
/** /**
* Underlying source locator. * Underlying source locator.
@ -60,6 +60,16 @@ public class CUISourceLocator implements IPersistableSourceLocator
*/ */
private boolean fAllowedToAsk; private boolean fAllowedToAsk;
/**
* Constructor for CUISourceLocator.
*/
public CUISourceLocator()
{
fSourceLocator = new CSourceLocator();
fAllowedToAsk = true;
}
/** /**
* Constructor for CUISourceLocator. * Constructor for CUISourceLocator.
*/ */
@ -75,7 +85,7 @@ public class CUISourceLocator implements IPersistableSourceLocator
*/ */
public String getMemento() throws CoreException public String getMemento() throws CoreException
{ {
return null; return fSourceLocator.getMemento();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -83,6 +93,7 @@ public class CUISourceLocator implements IPersistableSourceLocator
*/ */
public void initializeFromMemento( String memento ) throws CoreException public void initializeFromMemento( String memento ) throws CoreException
{ {
fSourceLocator.initializeFromMemento( memento );
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -90,6 +101,7 @@ public class CUISourceLocator implements IPersistableSourceLocator
*/ */
public void initializeDefaults( ILaunchConfiguration configuration ) throws CoreException public void initializeDefaults( ILaunchConfiguration configuration ) throws CoreException
{ {
fSourceLocator.initializeDefaults( configuration );
} }
/* (non-Javadoc) /* (non-Javadoc)