mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for bug 51062: Source locator oddness.
This commit is contained in:
parent
84cfa94f9b
commit
934d7c87a0
2 changed files with 23 additions and 34 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2004-02-11 Mikhail Khodjaiants
|
||||||
|
Fix for bug 51062: Source locator oddness.
|
||||||
|
* DefualtSourceLocator.java
|
||||||
|
|
||||||
2004-02-10 Mikhail Khodjaiants
|
2004-02-10 Mikhail Khodjaiants
|
||||||
Fix for bug 40108: The memory view does not handle big/little endian.
|
Fix for bug 40108: The memory view does not handle big/little endian.
|
||||||
* MemoryPresentation.java
|
* MemoryPresentation.java
|
||||||
|
|
|
@ -131,11 +131,6 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
private static final String ATTR_PROJECT = "project";
|
private static final String ATTR_PROJECT = "project";
|
||||||
private static final String ATTR_MEMENTO = "memento";
|
private static final String ATTR_MEMENTO = "memento";
|
||||||
|
|
||||||
/**
|
|
||||||
* The project being debugged.
|
|
||||||
*/
|
|
||||||
private IProject fProject = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Underlying source locator.
|
* Underlying source locator.
|
||||||
*/
|
*/
|
||||||
|
@ -154,12 +149,12 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
*/
|
*/
|
||||||
public String getMemento() throws CoreException
|
public String getMemento() throws CoreException
|
||||||
{
|
{
|
||||||
if ( fSourceLocator != null )
|
if ( getCSourceLocator() != null )
|
||||||
{
|
{
|
||||||
Document doc = new DocumentImpl();
|
Document doc = new DocumentImpl();
|
||||||
Element node = doc.createElement( ELEMENT_NAME );
|
Element node = doc.createElement( ELEMENT_NAME );
|
||||||
doc.appendChild( node );
|
doc.appendChild( node );
|
||||||
node.setAttribute( ATTR_PROJECT, fSourceLocator.getProject().getName() );
|
node.setAttribute( ATTR_PROJECT, getCSourceLocator().getProject().getName() );
|
||||||
|
|
||||||
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
||||||
if ( psl != null )
|
if ( psl != null )
|
||||||
|
@ -204,28 +199,18 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
abort( "Unable to restore prompting source locator - invalid format.", null );
|
abort( "Unable to restore prompting source locator - invalid format.", null );
|
||||||
}
|
}
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject( projectName );
|
||||||
if ( project == null || !project.exists() || !project.isOpen() )
|
if ( getCSourceLocator() == null )
|
||||||
{
|
setCSourceLocator( SourceLookupFactory.createSourceLocator( project ) );
|
||||||
abort( MessageFormat.format( "Unable to restore prompting source locator - project {0} not found.", new String[] { projectName } ), null );
|
if ( getCSourceLocator().getProject() != null && !getCSourceLocator().getProject().equals( project ) )
|
||||||
}
|
|
||||||
ICSourceLocator locator = getCSourceLocator();
|
|
||||||
if ( locator == null )
|
|
||||||
{
|
|
||||||
fSourceLocator = SourceLookupFactory.createSourceLocator( project );
|
|
||||||
}
|
|
||||||
else if ( locator.getProject() != null && !project.equals( locator.getProject() ) )
|
|
||||||
{
|
|
||||||
return;
|
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 );
|
||||||
|
|
||||||
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
IPersistableSourceLocator psl = getPersistableSourceLocator();
|
||||||
if ( psl != null )
|
if ( psl != null )
|
||||||
{
|
|
||||||
psl.initializeFromMemento( data );
|
psl.initializeFromMemento( data );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
abort( "Unable to restore C/C++ source locator - invalid format.", null );
|
abort( "Unable to restore C/C++ source locator - invalid format.", null );
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch( ParserConfigurationException e )
|
catch( ParserConfigurationException e )
|
||||||
|
@ -248,7 +233,7 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
*/
|
*/
|
||||||
public void initializeDefaults( ILaunchConfiguration configuration ) throws CoreException
|
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, "" );
|
String memento = configuration.getAttribute( ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, "" );
|
||||||
if ( !isEmpty( memento ) )
|
if ( !isEmpty( memento ) )
|
||||||
initializeFromMemento( memento );
|
initializeFromMemento( memento );
|
||||||
|
@ -259,19 +244,19 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
*/
|
*/
|
||||||
public Object getAdapter( Class adapter )
|
public Object getAdapter( Class adapter )
|
||||||
{
|
{
|
||||||
if ( fSourceLocator instanceof IAdaptable )
|
if ( getCSourceLocator() instanceof IAdaptable )
|
||||||
{
|
{
|
||||||
if ( adapter.equals( ICSourceLocator.class ) )
|
if ( adapter.equals( ICSourceLocator.class ) )
|
||||||
{
|
{
|
||||||
return ((IAdaptable)fSourceLocator).getAdapter( adapter );
|
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
|
||||||
}
|
}
|
||||||
if ( adapter.equals( IResourceChangeListener.class ) )
|
if ( adapter.equals( IResourceChangeListener.class ) )
|
||||||
{
|
{
|
||||||
return ((IAdaptable)fSourceLocator).getAdapter( adapter );
|
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
|
||||||
}
|
}
|
||||||
if ( adapter.equals( ISourceMode.class ) )
|
if ( adapter.equals( ISourceMode.class ) )
|
||||||
{
|
{
|
||||||
return ((IAdaptable)fSourceLocator).getAdapter( adapter );
|
return ((IAdaptable)getCSourceLocator()).getAdapter( adapter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -285,7 +270,7 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
Object res = cacheLookup( stackFrame );
|
Object res = cacheLookup( stackFrame );
|
||||||
if ( res == null )
|
if ( res == null )
|
||||||
{
|
{
|
||||||
res = fSourceLocator.getSourceElement( stackFrame );
|
res = getCSourceLocator().getSourceElement( stackFrame );
|
||||||
if ( res instanceof List )
|
if ( res instanceof List )
|
||||||
{
|
{
|
||||||
List list = (List)res;
|
List list = (List)res;
|
||||||
|
@ -317,11 +302,6 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject getProject()
|
|
||||||
{
|
|
||||||
return fProject;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator locator )
|
protected void saveChanges( ILaunchConfiguration configuration, IPersistableSourceLocator locator )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -396,6 +376,11 @@ public class DefaultSourceLocator implements IPersistableSourceLocator, IAdaptab
|
||||||
{
|
{
|
||||||
return fSourceLocator;
|
return fSourceLocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCSourceLocator( ICSourceLocator locator )
|
||||||
|
{
|
||||||
|
fSourceLocator = locator;
|
||||||
|
}
|
||||||
|
|
||||||
private IPersistableSourceLocator getPersistableSourceLocator()
|
private IPersistableSourceLocator getPersistableSourceLocator()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue