Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Khodjaiants2004-02-11 19:07:23 +0000
committerMikhail Khodjaiants2004-02-11 19:07:23 +0000
commit027d6dd7525d2863a5c93852b0eacf09cb9cc720 (patch)
treeb8cd0f22ccd61eed6f4f7d9e6f8fd5a2f6cdef00
parente88f821bbea2536bed54c43a675848d06275aba9 (diff)
downloadorg.eclipse.cdt-027d6dd7525d2863a5c93852b0eacf09cb9cc720.tar.gz
org.eclipse.cdt-027d6dd7525d2863a5c93852b0eacf09cb9cc720.tar.xz
org.eclipse.cdt-027d6dd7525d2863a5c93852b0eacf09cb9cc720.zip
Fix for bug 51062: Source locator oddness.
-rw-r--r--debug/org.eclipse.cdt.debug.ui/ChangeLog4
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java51
2 files changed, 22 insertions, 33 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index f2c0769c999..15987aaeb1c 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,7 @@
+2004-02-11 Mikhail Khodjaiants
+ Fix for bug 51062: Source locator oddness.
+ * DefualtSourceLocator.java
+
2004-02-10 Mikhail Khodjaiants
Fix for bug 40108: The memory view does not handle big/little endian.
* MemoryPresentation.java
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
index 5dac8882209..3e0167cd310 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/DefaultSourceLocator.java
@@ -132,11 +132,6 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
private static final String ATTR_MEMENTO = "memento";
/**
- * The project being debugged.
- */
- private IProject fProject = null;
-
- /**
* Underlying source locator.
*/
private ICSourceLocator fSourceLocator;
@@ -154,12 +149,12 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
*/
public String getMemento() throws CoreException
{
- if ( fSourceLocator != null )
+ if ( getCSourceLocator() != null )
{
Document doc = new DocumentImpl();
Element node = doc.createElement( ELEMENT_NAME );
doc.appendChild( node );
- node.setAttribute( ATTR_PROJECT, fSourceLocator.getProject().getName() );
+ node.setAttribute( ATTR_PROJECT, getCSourceLocator().getProject().getName() );
IPersistableSourceLocator psl = getPersistableSourceLocator();
if ( psl != null )
@@ -204,28 +199,18 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
abort( "Unable to restore prompting source locator - invalid format.", null );
}
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
+ if ( getCSourceLocator() == null )
+ setCSourceLocator( SourceLookupFactory.createSourceLocator( project ) );
+ if ( getCSourceLocator().getProject() != null && !getCSourceLocator().getProject().equals( project ) )
+ return;
if ( project == null || !project.exists() || !project.isOpen() )
- {
abort( MessageFormat.format( "Unable to restore prompting source locator - project {0} not found.", new String[] { projectName } ), null );
- }
- ICSourceLocator locator = getCSourceLocator();
- if ( locator == null )
- {
- fSourceLocator = SourceLookupFactory.createSourceLocator( project );
- }
- else if ( locator.getProject() != null && !project.equals( locator.getProject() ) )
- {
- return;
- }
+
IPersistableSourceLocator psl = getPersistableSourceLocator();
if ( psl != null )
- {
psl.initializeFromMemento( data );
- }
else
- {
abort( "Unable to restore C/C++ source locator - invalid format.", null );
- }
return;
}
catch( ParserConfigurationException e )
@@ -248,7 +233,7 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
*/
public void initializeDefaults( ILaunchConfiguration configuration ) throws CoreException
{
- fSourceLocator = SourceLookupFactory.createSourceLocator( getProject( configuration ) );
+ setCSourceLocator( SourceLookupFactory.createSourceLocator( getProject( configuration ) ) );
String memento = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, "" );
if ( !isEmpty( memento ) )
initializeFromMemento( memento );
@@ -259,19 +244,19 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
*/
public Object getAdapter( Class adapter )
{
- if ( fSourceLocator instanceof IAdaptable )
+ if ( getCSourceLocator() instanceof IAdaptable )
{
if ( adapter.equals( ICSourceLocator.class ) )
{
- return ((IAdaptable)fSourceLocator).getAdapter( adapter );
+ return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
}
if ( adapter.equals( IResourceChangeListener.class ) )
{
- return ((IAdaptable)fSourceLocator).getAdapter( adapter );
+ return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
}
if ( adapter.equals( ISourceMode.class ) )
{
- return ((IAdaptable)fSourceLocator).getAdapter( adapter );
+ return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
}
}
return null;
@@ -285,7 +270,7 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
Object res = cacheLookup( stackFrame );
if ( res == null )
{
- res = fSourceLocator.getSourceElement( stackFrame );
+ res = getCSourceLocator().getSourceElement( stackFrame );
if ( res instanceof List )
{
List list = (List)res;
@@ -317,11 +302,6 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
return res;
}
- public IProject getProject()
- {
- return fProject;
- }
-
protected void saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator locator )
{
try
@@ -396,6 +376,11 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
{
return fSourceLocator;
}
+
+ private void setCSourceLocator( ICSourceLocator locator )
+ {
+ fSourceLocator = locator;
+ }
private IPersistableSourceLocator getPersistableSourceLocator()
{

Back to the top