diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/CProjectSourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/CProjectSourceLocation.java index 99e807f64c6..4a989ea9b80 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/CProjectSourceLocation.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/CProjectSourceLocation.java @@ -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 ); } /** diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/CSourceLocator.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/CSourceLocator.java index aacecfb1abf..e0503cc063f 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/CSourceLocator.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/CSourceLocator.java @@ -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 + { + } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index 480de7892e2..44720fbbf97 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -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(); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CUISourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CUISourceLocator.java index 84a120b96a9..ca7ce73d7bb 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CUISourceLocator.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CUISourceLocator.java @@ -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)