mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix in the source locator's search algorithm.
This commit is contained in:
parent
773e0fb332
commit
d2726b6f54
2 changed files with 15 additions and 31 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2002-11-22 Mikhail Khodjaiants
|
||||||
|
Fix in the source locator's search algorithm.
|
||||||
|
* CProjectSourceLocator.java
|
||||||
|
|
||||||
2002-11-21 Mikhail Khodjaiants
|
2002-11-21 Mikhail Khodjaiants
|
||||||
The memory view does not display values if the address expression is '0xFFFFFFFF'.
|
The memory view does not display values if the address expression is '0xFFFFFFFF'.
|
||||||
* CFormattedMemoryBlock.java
|
* CFormattedMemoryBlock.java
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class CProjectSourceLocation implements ICSourceLocation
|
||||||
if ( file.isAbsolute() )
|
if ( file.isAbsolute() )
|
||||||
return findFileByAbsolutePath( name );
|
return findFileByAbsolutePath( name );
|
||||||
else
|
else
|
||||||
return findFileByRelativePath( name );
|
return findFileByRelativePath( getProject(), name );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -85,53 +85,33 @@ public class CProjectSourceLocation implements ICSourceLocation
|
||||||
{
|
{
|
||||||
return fProject;
|
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 )
|
private Object findFileByAbsolutePath( String name )
|
||||||
{
|
{
|
||||||
IPath path = new Path( name );
|
IPath path = new Path( name );
|
||||||
return findFile( getProject(), path.toOSString() );
|
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() );
|
Object result = findFileByAbsolutePath( path.toOSString() );
|
||||||
if ( result == null )
|
if ( result == null )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IResource[] members = getProject().members();
|
IResource[] members = container.members();
|
||||||
for ( int i = 0; i < members.length; ++i )
|
for ( int i = 0; i < members.length; ++i )
|
||||||
{
|
{
|
||||||
if ( members[i] instanceof IFolder )
|
if ( members[i] instanceof IFolder )
|
||||||
{
|
{
|
||||||
path = members[i].getLocation().append( fileName );
|
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 )
|
if ( result != null )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue