mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Implementation of the 'Source Lookup' property page.
This commit is contained in:
parent
ece05b22c6
commit
ef8512f6c9
6 changed files with 73 additions and 17 deletions
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
}
|
|
@ -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();
|
||||
}
|
|
@ -9,6 +9,7 @@ import java.io.File;
|
|||
|
||||
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 @@ import org.eclipse.core.runtime.Path;
|
|||
*
|
||||
* @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 @@ public class CDirectorySourceLocation implements ICSourceLocation
|
|||
*
|
||||
* @param directory a directory
|
||||
*/
|
||||
protected void setDirectory( IPath directory )
|
||||
private void setDirectory( IPath directory )
|
||||
{
|
||||
fDirectory = directory;
|
||||
}
|
||||
|
@ -102,7 +103,7 @@ public class CDirectorySourceLocation implements ICSourceLocation
|
|||
return fDirectory;
|
||||
}
|
||||
|
||||
protected void setAssociation( IPath association )
|
||||
private void setAssociation( IPath association )
|
||||
{
|
||||
fAssociation = association;
|
||||
}
|
||||
|
@ -149,18 +150,15 @@ public class CDirectorySourceLocation implements ICSourceLocation
|
|||
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 );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.HashMap;
|
|||
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 @@ import org.eclipse.core.runtime.Path;
|
|||
*
|
||||
* @since Sep 23, 2002
|
||||
*/
|
||||
public class CProjectSourceLocation implements ICSourceLocation
|
||||
public class CProjectSourceLocation implements IProjectSourceLocation
|
||||
{
|
||||
/**
|
||||
* The project associated with this source location
|
||||
|
|
|
@ -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 @@ public class CSourceLocator implements ICSourceLocator
|
|||
/**
|
||||
* 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
|
||||
|
@ -169,15 +170,25 @@ public class CSourceLocator implements ICSourceLocator
|
|||
public static ICSourceLocation[] getDefaultSourceLocations( IProject project )
|
||||
{
|
||||
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 @@ public class CSourceLocator implements ICSourceLocator
|
|||
// do nothing
|
||||
}
|
||||
}
|
||||
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
||||
}
|
||||
|
||||
|
||||
private Object findFileByAbsolutePath( String fileName )
|
||||
{
|
||||
Path path = new Path( fileName );
|
||||
|
|
Loading…
Add table
Reference in a new issue