mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +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
|
2002-12-29 Mikhail Khodjaiants
|
||||||
Fix in the 'supportsBreakpoints' method of CDebugTarget
|
Fix in the 'supportsBreakpoints' method of CDebugTarget
|
||||||
* CDebugTarget.java: No need to check if the breakpoint file belongs to the source locator.
|
* 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.core.resources.FileStorage;
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
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.IFile;
|
||||||
import org.eclipse.core.resources.IStorage;
|
import org.eclipse.core.resources.IStorage;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
@ -23,7 +24,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
*
|
*
|
||||||
* @since Sep 23, 2002
|
* @since Sep 23, 2002
|
||||||
*/
|
*/
|
||||||
public class CDirectorySourceLocation implements ICSourceLocation
|
public class CDirectorySourceLocation implements IDirectorySourceLocation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The root directory of this source location
|
* The root directory of this source location
|
||||||
|
@ -87,7 +88,7 @@ public class CDirectorySourceLocation implements ICSourceLocation
|
||||||
*
|
*
|
||||||
* @param directory a directory
|
* @param directory a directory
|
||||||
*/
|
*/
|
||||||
protected void setDirectory( IPath directory )
|
private void setDirectory( IPath directory )
|
||||||
{
|
{
|
||||||
fDirectory = directory;
|
fDirectory = directory;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +103,7 @@ public class CDirectorySourceLocation implements ICSourceLocation
|
||||||
return fDirectory;
|
return fDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setAssociation( IPath association )
|
private void setAssociation( IPath association )
|
||||||
{
|
{
|
||||||
fAssociation = association;
|
fAssociation = association;
|
||||||
}
|
}
|
||||||
|
@ -150,17 +151,14 @@ public class CDirectorySourceLocation implements ICSourceLocation
|
||||||
if ( path != null )
|
if ( path != null )
|
||||||
{
|
{
|
||||||
path = path.append( fileName );
|
path = path.append( fileName );
|
||||||
|
File file = path.toFile();
|
||||||
// Try for a file in another workspace project
|
if ( file.exists() )
|
||||||
|
{
|
||||||
IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
|
IFile f = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation( path );
|
||||||
if ( f != null )
|
if ( f != null )
|
||||||
{
|
{
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
File file = path.toFile();
|
|
||||||
if ( file.exists() )
|
|
||||||
{
|
|
||||||
return createExternalFileStorage( path );
|
return createExternalFileStorage( path );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocation;
|
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.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
@ -25,7 +26,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
*
|
*
|
||||||
* @since Sep 23, 2002
|
* @since Sep 23, 2002
|
||||||
*/
|
*/
|
||||||
public class CProjectSourceLocation implements ICSourceLocation
|
public class CProjectSourceLocation implements IProjectSourceLocation
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The project associated with this source location
|
* The project associated with this source location
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.resources.FileStorage;
|
import org.eclipse.cdt.core.resources.FileStorage;
|
||||||
import org.eclipse.cdt.debug.core.model.IStackFrameInfo;
|
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
|
* Returns a default collection of source locations for
|
||||||
* the given project. Default source locations consist
|
* 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
|
* @param project a project
|
||||||
* @return a collection of source locations for all required
|
* @return a collection of source locations for all required
|
||||||
|
@ -169,15 +170,25 @@ public class CSourceLocator implements ICSourceLocator
|
||||||
public static ICSourceLocation[] getDefaultSourceLocations( IProject project )
|
public static ICSourceLocation[] getDefaultSourceLocations( IProject project )
|
||||||
{
|
{
|
||||||
ArrayList list = new ArrayList();
|
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 )
|
if ( project != null )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IProject[] projects = project.getReferencedProjects();
|
IProject[] projects = project.getReferencedProjects();
|
||||||
list.add( new CProjectSourceLocation( project ) );
|
|
||||||
for ( int i = 0; i < projects.length; i++ )
|
for ( int i = 0; i < projects.length; i++ )
|
||||||
{
|
{
|
||||||
list.add( new CProjectSourceLocation( projects[i] ) );
|
list.add( new CProjectSourceLocation( projects[i] ) );
|
||||||
|
addReferencedSourceLocations( list, projects[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( CoreException e )
|
catch( CoreException e )
|
||||||
|
@ -185,7 +196,6 @@ public class CSourceLocator implements ICSourceLocator
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (ICSourceLocation[])list.toArray( new ICSourceLocation[list.size()] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object findFileByAbsolutePath( String fileName )
|
private Object findFileByAbsolutePath( String fileName )
|
||||||
|
|
Loading…
Add table
Reference in a new issue