Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Implementation of the 'Source Lookup' property page (core).

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision 1.84
diff -u -r1.84 ChangeLog
--- ChangeLog 29 Dec 2002 23:41:52 -0000 1.84
+++ ChangeLog 29 Dec 2002 23:54:40 -0000
@@ -1,3 +1,11 @@
+2002-12-18 Mikhail Khodjaiants
+ Implementation of the 'Source Lookup' property page.
+ * IDirectorySourceLocation.java: new interface
+ * IProjectSourceLocation.java: new interface
+ * CDirectorySourceLocation.java
+ * CProjectSourceLocation.java
+ * CSourceLocator.java
+
 2002-12-29 Mikhail Khodjaiants
   Fix in the 'supportsBreakpoints' method of CDebugTarget
   * CDebugTarget.java: No need to check if the breakpoint file belongs to the source locator.
Index: src/org/eclipse/cdt/debug/core/sourcelookup/IDirectorySourceLocation.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/core/sourcelookup/IDirectorySourceLocation.java
diff -N src/org/eclipse/cdt/debug/core/sourcelookup/IDirectorySourceLocation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/core/sourcelookup/IDirectorySourceLocation.java 29 Dec 2002 23:54:40 -0000
@@ -0,0 +1,20 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.core.sourcelookup;
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Dec 24, 2002
+ */
+public interface IDirectorySourceLocation extends ICSourceLocation
+{
+ IPath getDirectory();
+ IPath getAssociation();
+}
Index: src/org/eclipse/cdt/debug/core/sourcelookup/IProjectSourceLocation.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/core/sourcelookup/IProjectSourceLocation.java
diff -N src/org/eclipse/cdt/debug/core/sourcelookup/IProjectSourceLocation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/core/sourcelookup/IProjectSourceLocation.java 29 Dec 2002 23:54:40 -0000
@@ -0,0 +1,19 @@
+/*
+ *(c) Copyright QNX Software Systems Ltd. 2002.
+ * All Rights Reserved.
+ *
+ */
+package org.eclipse.cdt.debug.core.sourcelookup;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ *
+ * Enter type comment.
+ *
+ * @since Dec 24, 2002
+ */
+public interface IProjectSourceLocation extends ICSourceLocation
+{
+ IProject getProject();
+}
Index: src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java,v
retrieving revision 1.3
diff -u -r1.3 CDirectorySourceLocation.java
--- src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java 20 Dec 2002 22:21:32 -0000 1.3
+++ src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java 29 Dec 2002 23:54:40 -0000
@@ -9,6 +9,7 @@
 
 import org.eclipse.cdt.core.resources.FileStorage;
 import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
+import org.eclipse.cdt.debug.core.sourcelookup.IDirectorySourceLocation;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IStorage;
 import org.eclipse.core.resources.ResourcesPlugin;
@@ -23,7 +24,7 @@
  *
  * @since Sep 23, 2002
  */
-public class CDirectorySourceLocation implements ICSourceLocation
+public class CDirectorySourceLocation implements IDirectorySourceLocation
 {
  /**
   * The root directory of this source location
@@ -87,7 +88,7 @@
   *
   * @param directory a directory
   */
- protected void setDirectory( IPath directory )
+ private void setDirectory( IPath directory )
  {
   fDirectory = directory;
  }
@@ -102,7 +103,7 @@
   return fDirectory;
  }
 
- protected void setAssociation( IPath association )
+ private void setAssociation( IPath association )
  {
   fAssociation = association;
  }
@@ -149,18 +150,15 @@
   IPath path = getDirectory();
   if ( path != null )
   {
-   path = path.append( fileName );

-   // Try for a file in another workspace project
-   IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
-   if ( f != null )
-   {
-    return f;
-   }

+   path = path.append( fileName ); 
    File file = path.toFile();
    if ( file.exists() )
    {
+    IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
+    if ( f != null )
+    {
+     return f;
+    }
     return createExternalFileStorage( path );
    }
   }
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.5
diff -u -r1.5 CProjectSourceLocation.java
--- src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java 20 Dec 2002 22:21:32 -0000 1.5
+++ src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java 29 Dec 2002 23:54:41 -0000
@@ -10,6 +10,7 @@
 import java.util.HashSet;
 
 import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
+import org.eclipse.cdt.debug.core.sourcelookup.IProjectSourceLocation;
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
@@ -25,7 +26,7 @@
  *
  * @since Sep 23, 2002
  */
-public class CProjectSourceLocation implements ICSourceLocation
+public class CProjectSourceLocation implements IProjectSourceLocation
 {
  /**
   * The project associated with this source location
Index: src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java,v
retrieving revision 1.5
diff -u -r1.5 CSourceLocator.java
--- src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java 17 Dec 2002 19:56:22 -0000 1.5
+++ src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceLocator.java 29 Dec 2002 23:54:41 -0000
@@ -7,6 +7,7 @@
 package org.eclipse.cdt.debug.internal.core.sourcelookup;
 
 import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.cdt.core.resources.FileStorage;
 import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
@@ -159,7 +160,7 @@
  /**
   * Returns a default collection of source locations for
   * the given project. Default source locations consist
-  * of the given project and all of its referenced projects .
+  * of the given project and all of its referenced projects.
   *
   * @param project a project
   * @return a collection of source locations for all required
@@ -171,13 +172,23 @@
   ArrayList list = new ArrayList();
   if ( project != null )
   {
+   list.add( new CProjectSourceLocation( project ) );
+   addReferencedSourceLocations( list, project );
+  }
+  return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
+ }
+
+ private static void addReferencedSourceLocations( List list, IProject project )
+ {
+  if ( project != null )
+  {
    try
    {
     IProject[] projects = project.getReferencedProjects();
-    list.add( new CProjectSourceLocation( project ) );
     for ( int i = 0; i < projects.length; i++ )
     {
      list.add( new CProjectSourceLocation( projects[i] ) );
+     addReferencedSourceLocations( list, projects[i] );
     }
    }
    catch( CoreException e )
@@ -185,9 +196,8 @@
     // do nothing
    }
   }
-  return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
  }

+  
  private Object findFileByAbsolutePath( String fileName )
  {
   Path path = new Path( fileName );

Back to the top