diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index 5e5c2cf5bdc..3c7ceb3f367 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -3,6 +3,31 @@
'setCurrentThread': check if the old current thread is not null.
* CDebugTarget.java
+2003-10-17 Mikhail Khodjaiants
+ Core support of the 'Search for duplicate source files' option.
+ * ICSourceLocation.java
+ * ICSourceLocator.java
+ * CDirectorySourceLocation.java
+ * CProjectSourceLocation.java
+ * CSourceLocator.java
+ * CSourceManager.java
+
+2003-10-17 Mikhail Khodjaiants
+ If the target is suspended by a line breakpoint the source manager tries to retrieve
+ the file resource from the breakpoint marker.
+ * CSourceManager.java
+ * CDebugTarget.java
+
+2003-10-15 Mikhail Khodjaiants
+ Improving the source search algorithms.
+ * CDirectorySourceLocation.java
+ * CProjectSourceLocation.java
+ * CSourceLocator.java
+
+2003-10-14 Mikhail Khodjaiants
+ Improved the source search algorithm.
+ * CProjectSourceLocation.java
+
2003-10-13 Mikhail Khodjaiants
Fix for bug 43372: changed the source lookup procedures to avoid the usage of 'getCanonicalPath'.
* CDirectorySourceLocation.java
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java
index 9c94ee7c422..1f8f10db517 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocation.java
@@ -24,7 +24,7 @@ public interface ICSourceLocation extends IAdaptable
{
/**
* Returns an object representing the source code
- * for a type with the specified name, or null
+ * for a file with the specified name, or null
* if none could be found. The source element
* returned is implementation specific - for example, a
* resource, a local file, a zip file entry, etc.
@@ -35,7 +35,7 @@ public interface ICSourceLocation extends IAdaptable
* @exception CoreException if an exception occurs while searching for the specified source element
*/
Object findSourceElement( String name ) throws CoreException;
-
+
/**
* Returns a memento for this source location from which this
* source location can be reconstructed.
@@ -43,7 +43,7 @@ public interface ICSourceLocation extends IAdaptable
* @return a memento for this source location
* @exception CoreException if unable to create a memento
*/
- public String getMemento() throws CoreException;
+ String getMemento() throws CoreException;
/**
* Initializes this source location from the given memento.
@@ -52,5 +52,19 @@ public interface ICSourceLocation extends IAdaptable
* @exception CoreException if unable to initialize this source
* location
*/
- public void initializeFrom( String memento ) throws CoreException;
+ void initializeFrom( String memento ) throws CoreException;
+
+ /**
+ * Returns whether to search for all source elements, or just the first match.
+ *
+ * @return whether to search for all source elements, or just the first match
+ */
+ boolean searchForDuplicateFiles();
+
+ /**
+ * Sets the value of the 'search for duplicate source files' flag.
+ *
+ * @param search - a value to set
+ */
+ void setSearchForDuplicateFiles( boolean search );
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocator.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocator.java
index 5630c38a04b..9b5a2383b21 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocator.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ICSourceLocator.java
@@ -71,4 +71,18 @@ public interface ICSourceLocator extends ISourceLocator
* @return source element
*/
Object findSourceElement( String fileName );
-}
\ No newline at end of file
+
+ /**
+ * Returns whether to search for all source elements, or just the first match.
+ *
+ * @return whether to search for all source elements, or just the first match
+ */
+ boolean searchForDuplicateFiles();
+
+ /**
+ * Sets the value of the 'search for duplicate source files' flag.
+ *
+ * @param search - a value to set
+ */
+ void setSearchForDuplicateFiles( boolean search );
+}
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 497422ed4d7..a2650912a73 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
@@ -442,6 +442,13 @@ public class CDebugTarget extends CDebugElement
ISourceLocator locator = getLaunch().getSourceLocator();
if ( locator instanceof IAdaptable )
{
+ ICSourceLocator clocator = (ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class );
+ if ( clocator instanceof IAdaptable )
+ {
+ CSourceManager sm = (CSourceManager)((IAdaptable)clocator).getAdapter( CSourceManager.class );
+ if ( sm != null )
+ sm.setDebugTarget( this );
+ }
IResourceChangeListener listener = (IResourceChangeListener)((IAdaptable)locator).getAdapter( IResourceChangeListener.class );
if ( listener != null )
CCorePlugin.getWorkspace().addResourceChangeListener( listener );
@@ -2342,14 +2349,15 @@ public class CDebugTarget extends CDebugElement
public void setCurrentThread( IThread thread ) throws DebugException
{
if ( !isSuspended() || !isAvailable() || thread == null || !(thread instanceof CThread) )
+ {
return;
+ }
try
{
CThread oldThread = (CThread)getCurrentThread();
- if ( !thread.equals( oldThread ) )
+ if ( !oldThread.equals( thread ) )
{
- if ( oldThread != null )
- oldThread.setCurrent( false );
+ oldThread.setCurrent( false );
getCDITarget().setCurrentThread( ((CThread)thread).getCDIThread() );
((CThread)thread).setCurrent( true );
}
@@ -2776,6 +2784,26 @@ public class CDebugTarget extends CDebugElement
return fRunningInfo;
}
+ public IFile getCurrentBreakpointFile()
+ {
+ Object info = getCurrentStateInfo();
+ if ( info instanceof ICDIBreakpointHit )
+ {
+ ICDIBreakpoint cdiBreakpoint = ((ICDIBreakpointHit)info).getBreakpoint();
+ if ( cdiBreakpoint != null )
+ {
+ IBreakpoint breakpoint = findBreakpoint( cdiBreakpoint );
+ if ( breakpoint instanceof ICLineBreakpoint )
+ {
+ IResource resource = ((ICLineBreakpoint)breakpoint).getMarker().getResource();
+ if ( resource instanceof IFile )
+ return (IFile)resource;
+ }
+ }
+ }
+ return null;
+ }
+
protected void setRunningInfo( RunningInfo info )
{
fRunningInfo = info;
@@ -2801,6 +2829,7 @@ public class CDebugTarget extends CDebugElement
}
setRunningInfo( info );
}
+
/*
private boolean applyDeferredBreakpoints()
{
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java
index 86e280423c4..16fa6c2bafc 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java
@@ -9,6 +9,7 @@ import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.text.MessageFormat;
+import java.util.LinkedList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -56,6 +57,8 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
*/
private IPath fAssociation = null;
+ private boolean fSearchForDuplicateFiles = false;
+
/**
* Constructor for CDirectorySourceLocation.
*/
@@ -177,11 +180,16 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
}
// Try for a file in another workspace project
- IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( filePath );
- if ( f != null && f.exists() )
- {
- return f;
- }
+ IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( filePath );
+ LinkedList list = new LinkedList();
+ for ( int j = 0; j < wsFiles.length; ++j )
+ if ( wsFiles[j].exists() )
+ if ( !searchForDuplicateFiles() )
+ return wsFiles[j];
+ else
+ list.add( wsFiles[j] );
+ if ( list.size() > 0 )
+ return ( list.size() == 1 ) ? list.getFirst() : list;
file = filePath.toFile();
if ( file.exists() )
@@ -201,12 +209,18 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
if ( file.exists() )
{
path = new Path( file.getAbsolutePath() ); // can't use getCanonicalPath because of links
- IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
- if ( f != null && f.exists() )
- {
- return f;
- }
- return createExternalFileStorage( path );
+ IFile[] wsFiles = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation( path );
+ LinkedList list = new LinkedList();
+ for ( int j = 0; j < wsFiles.length; ++j )
+ if ( wsFiles[j].exists() )
+ if ( !searchForDuplicateFiles() )
+ return wsFiles[j];
+ else
+ list.add( wsFiles[j] );
+ if ( list.size() > 0 )
+ return ( list.size() == 1 ) ? list.getFirst() : list;
+ else
+ return createExternalFileStorage( path );
}
}
return null;
@@ -355,4 +369,20 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation
String pathString = path.removeLastSegments( path.segmentCount() - segCount ).toOSString();
return prefixString.equalsIgnoreCase( pathString );
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation#setSearchForDuplicateFiles(boolean)
+ */
+ public void setSearchForDuplicateFiles( boolean search )
+ {
+ fSearchForDuplicateFiles = search;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation#searchForDuplicateFiles()
+ */
+ public boolean searchForDuplicateFiles()
+ {
+ return fSearchForDuplicateFiles;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java
index 5e95e091e86..2890bfde7a3 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java
@@ -12,7 +12,6 @@ import java.text.MessageFormat;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
-import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@@ -23,6 +22,7 @@ import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy;
@@ -31,6 +31,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -61,6 +62,8 @@ public class CProjectSourceLocation implements IProjectSourceLocation
private HashSet fNotFoundCache = new HashSet( 20 );
private boolean fGenerated = true;
+
+ private boolean fSearchForDuplicateFiles = false;
/**
* Constructor for CProjectSourceLocation.
@@ -76,7 +79,6 @@ public class CProjectSourceLocation implements IProjectSourceLocation
{
setProject( project );
fGenerated = true;
- initializeFolders();
}
/**
@@ -86,7 +88,6 @@ public class CProjectSourceLocation implements IProjectSourceLocation
{
setProject( project );
fGenerated = generated;
- initializeFolders();
}
/* (non-Javadoc)
@@ -151,17 +152,24 @@ public class CProjectSourceLocation implements IProjectSourceLocation
private Object doFindSourceElement( String name )
{
File file = new File( name );
- return ( file.isAbsolute() ) ? findFileByAbsolutePath( name ) :
- findFileByRelativePath( name );
+ return ( file.isAbsolute() ) ? findFileByAbsolutePath( file ) : findFileByRelativePath( name );
}
- private Object findFileByAbsolutePath( String name )
+ private Object findFileByAbsolutePath( File file )
{
- File file = new File( name );
- Object result = null;
- if ( file.isAbsolute() && file.exists() )
- result = findFile( file );
- return result;
+ LinkedList list = new LinkedList();
+ if ( file.exists() )
+ {
+ IPath path = new Path( file.getAbsolutePath() );
+ IFile[] wsFiles = CDebugCorePlugin.getWorkspace().getRoot().findFilesForLocation( path );
+ for ( int i = 0; i < wsFiles.length; ++i )
+ if ( wsFiles[i].getProject().equals( getProject() ) && wsFiles[i].exists() )
+ if ( !searchForDuplicateFiles() )
+ return wsFiles[i];
+ else
+ list.add( wsFiles[i] );
+ }
+ return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
}
private Object findFileByRelativePath( String fileName )
@@ -170,66 +178,22 @@ public class CProjectSourceLocation implements IProjectSourceLocation
LinkedList list = new LinkedList();
for ( int i = 0; i < folders.length; ++i )
{
- if ( list.size() > 0 && !searchForDuplicateFileNames() )
+ if ( list.size() > 0 && !searchForDuplicateFiles() )
break;
IPath path = folders[i].getLocation().append( fileName );
- Object result = findFile( new File( path.toOSString() ) );
- if ( result instanceof List )
- list.addAll( (List)result );
- else if ( result != null )
- list.add( result );
- }
- if ( list.size() == 1 || (list.size() > 0 && !searchForDuplicateFileNames()) )
- return list.getFirst();
- if ( list.size() > 0 )
- return list;
- return null;
- }
-
- private Object findFile( final File file )
- {
- if ( file != null )
- {
- final String name = file.getName();
- IResource[] folders = getFolders();
- final LinkedList list = new LinkedList();
- for ( int i = 0; i < folders.length; ++i )
+ File file = new File( path.toOSString() );
+ if ( file.exists() )
{
- // The workspace resources are case-sensitive, so we can not just
- // append the file name to the folder name and check if the result exists.
- if ( list.size() > 0 && !searchForDuplicateFileNames() )
- break;
- try
- {
- folders[i].accept(
- new IResourceProxyVisitor()
- {
- public boolean visit( IResourceProxy proxy ) throws CoreException
- {
- // use equalsIgnoreCase to make it work for Wondows
- if ( proxy.getType() == IResource.FILE && proxy.getName().equalsIgnoreCase( name ) )
- {
- IResource resource = proxy.requestResource();
- File file1 = new File( resource.getLocation().toOSString() );
- if ( file1.exists() && file1.equals( file ) )
- list.addLast( resource );
- return false;
- }
- return true;
- }
- },
- IResource.NONE );
- }
- catch( CoreException e )
- {
- }
+ IFile[] wsFiles = CDebugCorePlugin.getWorkspace().getRoot().findFilesForLocation( path );
+ for ( int j = 0; j < wsFiles.length; ++j )
+ if ( wsFiles[j].exists() )
+ if ( !searchForDuplicateFiles() )
+ return wsFiles[j];
+ else
+ list.add( wsFiles[j] );
}
- if ( list.size() == 1 || (list.size() > 0 && !searchForDuplicateFileNames()) )
- return list.getFirst();
- if ( list.size() > 0 )
- return list;
}
- return null;
+ return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
}
private Object cacheLookup( String name )
@@ -308,7 +272,6 @@ public class CProjectSourceLocation implements IProjectSourceLocation
if ( isGeneric == null || isGeneric.trim().length() == 0 )
isGeneric = Boolean.FALSE.toString();
setGenerated( isGeneric.equals( Boolean.TRUE.toString() ) );
- initializeFolders();
return;
}
catch( ParserConfigurationException e )
@@ -403,12 +366,26 @@ public class CProjectSourceLocation implements IProjectSourceLocation
protected IResource[] getFolders()
{
+ if ( fFolders == null )
+ initializeFolders();
return fFolders;
}
- protected boolean searchForDuplicateFileNames()
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation#searchForDuplicateFiles()
+ */
+ public boolean searchForDuplicateFiles()
{
- // for now
- return false;
+ return fSearchForDuplicateFiles;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation#setSearchForDuplicateFiles(boolean)
+ */
+ public void setSearchForDuplicateFiles( boolean search )
+ {
+ fCache.clear();
+ fNotFoundCache.clear();
+ fSearchForDuplicateFiles = search;
}
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
index 7f9e30dde75..c7980d7d829 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
@@ -6,7 +6,6 @@
package org.eclipse.cdt.debug.internal.core.sourcelookup;
-import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.text.MessageFormat;
@@ -14,6 +13,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
@@ -21,7 +21,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.xerces.dom.DocumentImpl;
-import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
@@ -36,10 +35,8 @@ import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
@@ -67,6 +64,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
private static final String ATTR_CLASS = "class";
private static final String ATTR_MEMENTO = "memento";
private static final String ATTR_PROJECT_NAME = "projectName";
+ private static final String ATTR_DUPLICATE_FILES = "duplicateFiles";
/**
* The project associated with this locator.
@@ -83,6 +81,12 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
*/
private List fReferencedProjects = new ArrayList( 10 );
+ /**
+ * The flag specifies whether to search for all source elements,
+ * or just the first match.
+ */
+ private boolean fDuplicateFiles = false;
+
/**
* Constructor for CSourceLocator.
*/
@@ -116,33 +120,37 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
protected Object getInput( IStackFrameInfo info )
{
- Object result = null;
+ LinkedList list = new LinkedList();
if ( info != null )
{
+ Object result = null;
String fileName = info.getFile();
if ( fileName != null && fileName.length() > 0 )
{
- result = findFileByAbsolutePath( fileName );
- if ( result == null )
+ ICSourceLocation[] locations = getSourceLocations();
+ for ( int i = 0; i < locations.length; ++i )
{
- ICSourceLocation[] locations = getSourceLocations();
- for ( int i = 0; i < locations.length; ++i )
+ try
{
- try
- {
- result = locations[i].findSourceElement( fileName );
- }
- catch( CoreException e )
- {
- // do nothing
- }
- if ( result != null )
+ result = locations[i].findSourceElement( fileName );
+ }
+ catch( CoreException e )
+ {
+ // do nothing
+ }
+ if ( result != null )
+ {
+ if ( result instanceof List )
+ list.addAll( (List)result );
+ else
+ list.add( result );
+ if ( !searchForDuplicateFiles() )
break;
}
}
}
}
- return result;
+ return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
}
/* (non-Javadoc)
@@ -165,7 +173,10 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
{
try
{
- if ( locations[i].findSourceElement( resource.getLocation().toOSString() ) != null )
+ Object result = locations[i].findSourceElement( resource.getLocation().toOSString() );
+ if ( result instanceof IFile && ((IFile)result).equals( resource ) )
+ return true;
+ if ( result instanceof List && ((List)result).contains( resource ) )
return true;
}
catch( CoreException e )
@@ -248,29 +259,6 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
return false;
}
- private Object findFileByAbsolutePath( String fileName )
- {
- File file = new File( fileName );
- if ( file.isAbsolute() && file.exists() )
- {
- try
- {
- Path path = new Path( file.getCanonicalPath() );
- // Try for a file in another workspace project
- IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
- if ( f != null && f.exists() )
- {
- return f;
- }
- return new FileStorage( path );
- }
- catch( IOException e )
- {
- }
- }
- return null;
- }
-
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#findSourceElement(String)
*/
@@ -279,23 +267,19 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
Object result = null;
if ( fileName != null && fileName.length() > 0 )
{
- result = findFileByAbsolutePath( fileName );
- if ( result == null )
+ ICSourceLocation[] locations = getSourceLocations();
+ for ( int i = 0; i < locations.length; ++i )
{
- ICSourceLocation[] locations = getSourceLocations();
- for ( int i = 0; i < locations.length; ++i )
+ try
{
- try
- {
- result = locations[i].findSourceElement( fileName );
- }
- catch( CoreException e )
- {
- // do nothing
- }
- if ( result != null )
- break;
+ result = locations[i].findSourceElement( fileName );
}
+ catch( CoreException e )
+ {
+ // do nothing
+ }
+ if ( result != null )
+ break;
}
}
return result;
@@ -313,7 +297,7 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
ICSourceLocation[] locations = getSourceLocations();
saveDisabledGenericSourceLocations( locations, doc, node );
saveAdditionalSourceLocations( locations, doc, node );
-
+ node.setAttribute( ATTR_DUPLICATE_FILES, new Boolean( searchForDuplicateFiles() ).toString() );
try
{
return CDebugUtils.serializeDocument( doc, " " );
@@ -365,6 +349,9 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
// To support old launch configuration
addOldLocations( root, sourceLocations );
setSourceLocations( (ICSourceLocation[])sourceLocations.toArray( new ICSourceLocation[sourceLocations.size()] ) );
+
+ setSearchForDuplicateFiles( Boolean.valueOf( root.getAttribute( ATTR_DUPLICATE_FILES ) ).booleanValue() );
+
return;
}
catch( ParserConfigurationException e )
@@ -725,4 +712,20 @@ public class CSourceLocator implements ICSourceLocator, IPersistableSourceLocato
fReferencedProjects = newRefs;
setSourceLocations( (ICSourceLocation[])newLocations.toArray( new ICSourceLocation[newLocations.size()] ) );
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#searchForDuplicateFiles()
+ */
+ public boolean searchForDuplicateFiles()
+ {
+ return fDuplicateFiles;
+ }
+
+ public void setSearchForDuplicateFiles( boolean search )
+ {
+ fDuplicateFiles = search;
+ ICSourceLocation[] locations = getSourceLocations();
+ for ( int i = 0; i < locations.length; ++i )
+ locations[i].setSearchForDuplicateFiles( search );
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
index 626b8cb2b04..58728b25cfe 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java
@@ -15,6 +15,7 @@ import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
+import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeListener;
@@ -39,7 +40,8 @@ public class CSourceManager implements ICSourceLocator,
private ISourceLocator fSourceLocator = null;
private int fMode = ISourceMode.MODE_SOURCE;
private int fRealMode = fMode;
- private ILaunch fLaunch = null;
+ private ILaunch fLaunch = null;
+ private CDebugTarget fDebugTarget = null;
/**
* Constructor for CSourceManager.
@@ -132,6 +134,8 @@ public class CSourceManager implements ICSourceLocator,
*/
public Object getAdapter( Class adapter )
{
+ if ( adapter.equals( CSourceManager.class ) )
+ return this;
if ( adapter.equals( IResourceChangeListener.class ) &&
fSourceLocator instanceof IResourceChangeListener )
return fSourceLocator;
@@ -148,7 +152,12 @@ public class CSourceManager implements ICSourceLocator,
if ( getMode() == ISourceMode.MODE_SOURCE && getSourceLocator() != null )
{
- result = getSourceLocator().getSourceElement( stackFrame );
+ // if the target is suspended by a line breakpoint the source manager
+ // tries to retrieve the file resource from the breakpoint marker.
+ if ( getDebugTarget() != null )
+ result = getDebugTarget().getCurrentBreakpointFile();
+ if ( result == null )
+ result = getSourceLocator().getSourceElement( stackFrame );
}
if ( result == null &&
( autoDisassembly || getMode() == ISourceMode.MODE_DISASSEMBLY ) &&
@@ -163,7 +172,7 @@ public class CSourceManager implements ICSourceLocator,
}
return result;
}
-
+
protected ICSourceLocator getCSourceLocator()
{
if ( getSourceLocator() instanceof ICSourceLocator )
@@ -256,4 +265,31 @@ public class CSourceManager implements ICSourceLocator,
{
return ( getCSourceLocator() != null ) ? getCSourceLocator().getProject() : null;
}
+
+ public void setDebugTarget( CDebugTarget target )
+ {
+ fDebugTarget = target;
+ }
+
+ protected CDebugTarget getDebugTarget()
+ {
+ return fDebugTarget;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#setSearchForDuplicateFiles(boolean)
+ */
+ public void setSearchForDuplicateFiles( boolean search )
+ {
+ if ( getCSourceLocator() != null )
+ getCSourceLocator().setSearchForDuplicateFiles( search );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator#searchForDuplicateFiles()
+ */
+ public boolean searchForDuplicateFiles()
+ {
+ return ( getCSourceLocator() != null ) ? getCSourceLocator().searchForDuplicateFiles() : false;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index a8e965bec97..c0308f5065f 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -2,6 +2,18 @@
Fix for PR 45957: Memory view: last column does not show updates.
* MemoryPresentation.java
+2003-10-17 Mikhail Khodjaiants
+ UI support of the 'Search for duplicate source files' option.
+ * icons/full/obj16/prj_file_obj.gif: new
+ * icons/full/obj16/ext_file_obj.gif: new
+ * CDebugImages.java
+ * CUISourceLocator.java
+ * SourceLookupBlock.java
+ * SourcePropertyPage.java
+
+2003-10-17 Mikhail Khodjaiants
+ * CDebugEditor.java: changed the message displayed when the source file not found.
+
2003-10-14 Mikhail Khodjaiants
* DebugTextHover.java: check if the result of 'evaluateExpression' is not null before trim it.
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
index 8d80183ccb0..b933118fc02 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
@@ -88,6 +88,8 @@ public class CDebugImages
public static final String IMG_OBJS_LOADED_SHARED_LIBRARY = NAME_PREFIX + "library_syms_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_SHARED_LIBRARY = NAME_PREFIX + "library_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_SIGNAL = NAME_PREFIX + "signal_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_WORKSPACE_SOURCE_FILE = NAME_PREFIX + "prj_file_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_OBJS_EXTERNAL_SOURCE_FILE = NAME_PREFIX + "ext_file_obj.gif"; //$NON-NLS-1$
public static final String IMG_LCL_TYPE_NAMES = NAME_PREFIX + "tnames_co.gif"; //$NON-NLS-1$
public static final String IMG_LCL_CHANGE_REGISTER_VALUE = NAME_PREFIX + "change_reg_value_co.gif"; //$NON-NLS-1$
@@ -155,6 +157,8 @@ public class CDebugImages
public static final ImageDescriptor DESC_OBJS_LOADED_SHARED_LIBRARY = createManaged( T_OBJ, IMG_OBJS_LOADED_SHARED_LIBRARY );
public static final ImageDescriptor DESC_OBJS_SHARED_LIBRARY = createManaged( T_OBJ, IMG_OBJS_SHARED_LIBRARY );
public static final ImageDescriptor DESC_OBJS_SIGNAL = createManaged( T_OBJ, IMG_OBJS_SIGNAL );
+ public static final ImageDescriptor DESC_OBJS_WORKSPACE_SOURCE_FILE = createManaged( T_OBJ, IMG_OBJS_WORKSPACE_SOURCE_FILE );
+ public static final ImageDescriptor DESC_OBJS_EXTERNAL_SOURCE_FILE = createManaged( T_OBJ, IMG_OBJS_EXTERNAL_SOURCE_FILE );
public static final ImageDescriptor DESC_WIZBAN_ADD_SOURCE_LOCATION = createManaged( T_WIZBAN, IMG_WIZBAN_ADD_SOURCE_LOCATION ); //$NON-NLS-1$
public static final ImageDescriptor DESC_WIZBAN_ADD_PRJ_SOURCE_LOCATION = createManaged( T_WIZBAN, IMG_WIZBAN_ADD_PRJ_SOURCE_LOCATION ); //$NON-NLS-1$
public static final ImageDescriptor DESC_WIZBAN_ADD_DIR_SOURCE_LOCATION = createManaged( T_WIZBAN, IMG_WIZBAN_ADD_DIR_SOURCE_LOCATION ); //$NON-NLS-1$
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java
index 81a4f3a972a..53b4cfa2a81 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/CUISourceLocator.java
@@ -5,14 +5,23 @@
*/
package org.eclipse.cdt.debug.ui.sourcelookup;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.core.sourcelookup.ISourceMode;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLocator;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceManager;
+import org.eclipse.cdt.debug.internal.ui.CDebugImageDescriptorRegistry;
+import org.eclipse.cdt.debug.internal.ui.CDebugImages;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField;
import org.eclipse.cdt.debug.internal.ui.editors.FileNotFoundElement;
import org.eclipse.cdt.debug.internal.ui.editors.NoSymbolOrSourceElement;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
+import org.eclipse.cdt.utils.ui.controls.ControlFactory;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.runtime.CoreException;
@@ -22,6 +31,14 @@ import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.model.IPersistableSourceLocator;
import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ListDialog;
/**
*
@@ -32,6 +49,62 @@ import org.eclipse.debug.core.model.IStackFrame;
*/
public class CUISourceLocator implements IAdaptable
{
+ public class SourceSelectionDialog extends ListDialog
+ {
+ private SelectionButtonDialogField fAlwaysUseThisFileButton = new SelectionButtonDialogField( SWT.CHECK );
+
+ public SourceSelectionDialog( Shell parent )
+ {
+ super( parent );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.dialogs.ListDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ protected Control createDialogArea( Composite parent )
+ {
+ Composite comp = ControlFactory.createComposite( parent, 1 );
+ super.createDialogArea( comp );
+ Composite comp1 = ControlFactory.createComposite( comp, 1 );
+ fAlwaysUseThisFileButton.setLabelText( "Always map to the selection" );
+ fAlwaysUseThisFileButton.doFillIntoGrid( comp1, 1 );
+ return comp;
+ }
+
+ public boolean alwaysMapToSelection()
+ {
+ return fAlwaysUseThisFileButton.isSelected();
+ }
+ }
+
+ public class SourceElementLabelProvider extends LabelProvider
+ {
+ protected CDebugImageDescriptorRegistry fDebugImageRegistry = CDebugUIPlugin.getImageDescriptorRegistry();
+
+ public SourceElementLabelProvider()
+ {
+ super();
+ }
+
+ public String getText(Object element)
+ {
+ if ( element instanceof IFile )
+ return ((IFile)element).getFullPath().toString();
+ if ( element instanceof FileStorage )
+ return ((FileStorage)element).getFullPath().toOSString();
+ return super.getText(element);
+ }
+
+ public Image getImage( Object element )
+ {
+ if ( element instanceof IFile )
+ return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_WORKSPACE_SOURCE_FILE );
+ if ( element instanceof FileStorage )
+ return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_EXTERNAL_SOURCE_FILE );
+ return super.getImage( element );
+ }
+ }
+
/**
* The project being debugged.
*/
@@ -41,7 +114,10 @@ public class CUISourceLocator implements IAdaptable
* Underlying source locator.
*/
private CSourceManager fSourceLocator;
-
+
+ private HashMap fFramesToSource = null;
+ private HashMap fNamesToSource = null;
+
/**
* Constructor for CUISourceLocator.
*/
@@ -53,7 +129,26 @@ public class CUISourceLocator implements IAdaptable
public Object getSourceElement( IStackFrame stackFrame )
{
- Object res = fSourceLocator.getSourceElement( stackFrame );
+ Object res = cacheLookup( stackFrame );
+ if ( res == null )
+ {
+ res = fSourceLocator.getSourceElement( stackFrame );
+ if ( res instanceof List )
+ {
+ List list = (List)res;
+ if ( list.size() != 0 )
+ {
+ SourceSelectionDialog dialog = createSourceSelectionDialog( list );
+ dialog.open();
+ Object[] objs = dialog.getResult();
+ res = ( objs != null && objs.length > 0 ) ? objs[0] : null;
+ if ( res != null )
+ cacheSourceElement( stackFrame, res, dialog.alwaysMapToSelection() );
+ }
+ else
+ res = null;
+ }
+ }
if ( res == null )
{
IStackFrameInfo frameInfo = (IStackFrameInfo)stackFrame.getAdapter( IStackFrameInfo.class );
@@ -104,4 +199,60 @@ public class CUISourceLocator implements IAdaptable
CDebugUIPlugin.errorDialog( e.getMessage(), (IStatus)null );
}
}
+
+ private SourceSelectionDialog createSourceSelectionDialog( List list )
+ {
+ SourceSelectionDialog dialog = new SourceSelectionDialog( CDebugUIPlugin.getActiveWorkbenchShell() );
+ dialog.setInput( list.toArray() );
+ dialog.setContentProvider( new ArrayContentProvider() );
+ dialog.setLabelProvider( new SourceElementLabelProvider() );
+ dialog.setTitle( "Selection needed" );
+ dialog.setMessage( "Debugger has found multiple files with the same name.\nPlease select one associated with the selected stack frame." );
+ dialog.setInitialSelections( new Object[] { list.get( 0 ) } );
+ return dialog;
+ }
+
+ private void cacheSourceElement( IStackFrame frame, Object sourceElement, boolean alwaysMapToSelection )
+ {
+ if ( alwaysMapToSelection )
+ {
+ String name = getFileName( frame );
+ if ( name != null )
+ {
+ if ( fNamesToSource == null )
+ fNamesToSource = new HashMap();
+ fNamesToSource.put( name, sourceElement );
+ }
+ }
+ else
+ {
+ if ( fFramesToSource == null )
+ fFramesToSource = new HashMap();
+ fFramesToSource.put( frame, sourceElement );
+ }
+ }
+
+ private Object cacheLookup( IStackFrame frame )
+ {
+ String name = getFileName( frame );
+ if ( name != null && fNamesToSource != null )
+ {
+ Object result = fNamesToSource.get( name );
+ if ( result != null )
+ return result;
+ }
+ return ( fFramesToSource != null ) ? fFramesToSource.get( frame ) : null;
+ }
+
+ private String getFileName( IStackFrame frame )
+ {
+ IStackFrameInfo frameInfo = (IStackFrameInfo)frame.getAdapter( IStackFrameInfo.class );
+ if ( frameInfo != null )
+ {
+ String name = frameInfo.getFile();
+ if ( name != null && name.trim().length() > 0 )
+ return name.trim();
+ }
+ return null;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
index 7e6562cbd7e..c4d9eaa161f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourceLookupBlock.java
@@ -25,6 +25,7 @@ import org.eclipse.cdt.debug.internal.ui.dialogfields.IDialogFieldListener;
import org.eclipse.cdt.debug.internal.ui.dialogfields.IListAdapter;
import org.eclipse.cdt.debug.internal.ui.dialogfields.LayoutUtil;
import org.eclipse.cdt.debug.internal.ui.dialogfields.ListDialogField;
+import org.eclipse.cdt.debug.internal.ui.dialogfields.SelectionButtonDialogField;
import org.eclipse.cdt.debug.internal.ui.dialogfields.Separator;
import org.eclipse.cdt.debug.internal.ui.wizards.AddSourceLocationWizard;
import org.eclipse.core.resources.IProject;
@@ -158,7 +159,7 @@ public class SourceLookupBlock
private Shell fShell = null;
private CheckedListDialogField fGeneratedSourceListField;
private SourceListDialogField fAddedSourceListField;
-// private SelectionButtonDialogField fSearchForDuplicateFiles;
+ private SelectionButtonDialogField fSearchForDuplicateFiles;
private ILaunchConfigurationDialog fLaunchConfigurationDialog = null;
private boolean fIsDirty = false;
private ICSourceLocator fLocator = null;
@@ -228,10 +229,17 @@ public class SourceLookupBlock
fAddedSourceListField.setUpButtonIndex( 2 );
fAddedSourceListField.setDownButtonIndex( 3 );
fAddedSourceListField.setRemoveButtonIndex( 5 );
-/*
fSearchForDuplicateFiles = new SelectionButtonDialogField( SWT.CHECK );
- fSearchForDuplicateFiles.setLabelText( "Search for duplicate files" );
-*/
+ fSearchForDuplicateFiles.setLabelText( "Search for duplicate source files" );
+ fSearchForDuplicateFiles.setDialogFieldListener(
+ new IDialogFieldListener()
+ {
+ public void dialogFieldChanged( DialogField field )
+ {
+ doCheckStateChanged();
+ }
+
+ } );
}
public void createControl( Composite parent )
@@ -277,9 +285,9 @@ public class SourceLookupBlock
viewer.setColumnProperties( new String[]{ CP_LOCATION, CP_ASSOCIATION } );
viewer.setCellModifier( createCellModifier() );
- new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
+// new Separator().doFillIntoGrid( fControl, 3, converter.convertHeightInCharsToPixels( 1 ) );
-// fSearchForDuplicateFiles.doFillIntoGrid( fControl, 3 );
+ fSearchForDuplicateFiles.doFillIntoGrid( fControl, 3 );
}
private ICellModifier createCellModifier()
@@ -333,6 +341,7 @@ public class SourceLookupBlock
ICSourceLocation[] locations = fLocator.getSourceLocations();
initializeGeneratedLocations( fLocator.getProject(), locations );
resetAdditionalLocations( locations );
+ fSearchForDuplicateFiles.setSelection( fLocator.searchForDuplicateFiles() );
}
}
@@ -491,6 +500,7 @@ public class SourceLookupBlock
locations = CSourceLocator.getDefaultSourceLocations( getProject() );
resetGeneratedLocations( locations );
resetAdditionalLocations( locations );
+ fSearchForDuplicateFiles.setSelection( false );
}
public IProject getProject()
@@ -521,4 +531,9 @@ public class SourceLookupBlock
return locations[i];
return null;
}
+
+ public boolean searchForDuplicateFiles()
+ {
+ return ( fSearchForDuplicateFiles != null ) ? fSearchForDuplicateFiles.isSelected() : false;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java
index 2cfa46a2e12..06379db740f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/sourcelookup/SourcePropertyPage.java
@@ -7,7 +7,6 @@ package org.eclipse.cdt.debug.ui.sourcelookup;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
-import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.resources.IProject;
@@ -107,7 +106,7 @@ public class SourcePropertyPage extends PropertyPage
{
try
{
- setSourceLocations( fBlock.getSourceLocations() );
+ setAttributes( fBlock );
}
catch( DebugException e )
{
@@ -118,7 +117,7 @@ public class SourcePropertyPage extends PropertyPage
return true;
}
- private void setSourceLocations( ICSourceLocation[] locations ) throws DebugException
+ private void setAttributes( SourceLookupBlock block ) throws DebugException
{
ICDebugTarget target = getDebugTarget();
if ( target != null )
@@ -128,7 +127,8 @@ public class SourcePropertyPage extends PropertyPage
ICSourceLocator locator = (ICSourceLocator)((IAdaptable)target.getLaunch().getSourceLocator()).getAdapter( ICSourceLocator.class );
if ( locator != null )
{
- locator.setSourceLocations( locations );
+ locator.setSourceLocations( block.getSourceLocations() );
+ locator.setSearchForDuplicateFiles( block.searchForDuplicateFiles() );
if ( target.getLaunch().getSourceLocator() instanceof IPersistableSourceLocator )
{
ILaunchConfiguration configuration = target.getLaunch().getLaunchConfiguration();