Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix in the source locator's search algorithm

Fix in the source locator's search algorithm.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.57
diff -u -r1.57 ChangeLog
--- ChangeLog 21 Nov 2002 21:58:05 -0000 1.57
+++ ChangeLog 22 Nov 2002 21:28:26 -0000
@@ -1,3 +1,7 @@
+2002-11-22 Mikhail Khodjaiants
+ Fix in the source locator's search algorithm.
+ * CProjectSourceLocator.java
+
 2002-11-21 Mikhail Khodjaiants
  The memory view does not display values if the address _expression_ is '0xFFFFFFFF'.
  * CFormattedMemoryBlock.java
Index: src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java,v
retrieving revision 1.2
diff -u -r1.2 CProjectSourceLocation.java
--- src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java 7 Nov 2002 21:54:40 -0000 1.2
+++ src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java 22 Nov 2002 21:28:26 -0000
@@ -49,7 +49,7 @@
    if ( file.isAbsolute() )
     return findFileByAbsolutePath( name );
    else
-    return findFileByRelativePath( name );
+    return findFileByRelativePath( getProject(), name );
   }
   return null;
  }
@@ -85,53 +85,33 @@
  {
   return fProject;
  }
-/*
- private IFile findFile( IContainer parent, IPath name ) throws CoreException
- {
-  if ( name.isAbsolute() )
-  {
-   if ( name.toOSString().startsWith( parent.getLocation().toOSString() ) )
-   {
-    name = new Path( name.toOSString().substring( parent.getLocation().toOSString().length() + 1 ) );
-   }
-  }
-  IResource found = parent.findMember( name );
-  if ( found != null && found.getType() == IResource.FILE )
-  {
-   return (IFile)found;
-  }
-  IResource[] children= parent.members();
-  for ( int i= 0; i < children.length; i++ )
-  {
-   if ( children[i] instanceof IContainer )
-   {
-    return findFile( (IContainer)children[i], name );
-   }
-  }
-  return null;  
- }
-*/
+
  private Object findFileByAbsolutePath( String name )
  {
   IPath path = new Path( name );
   return findFile( getProject(), path.toOSString() );
  }
 
- private Object findFileByRelativePath( String fileName )
+ private Object findFileByRelativePath( IContainer container, String fileName )
  {
-  IPath path = getProject().getLocation().append( fileName );
+  IPath rootPath = container.getLocation();
+  IPath path = rootPath.append( fileName );
   Object result = findFileByAbsolutePath( path.toOSString() );
   if ( result == null )
   {
    try
    {
-    IResource[] members = getProject().members();
+    IResource[] members = container.members();
     for ( int i = 0; i < members.length; ++i )
     {
      if ( members[i] instanceof IFolder )
      {
       path = members[i].getLocation().append( fileName );
-      result = findFile( (IContainer)members[i], path.toOSString() );
+      result = findFileByAbsolutePath( path.toOSString() );
+      if ( result == null )
+      {
+       result = findFileByRelativePath( (IFolder)members[i], fileName );
+      }
       if ( result != null )
        break;
      }


Back to the top