1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Applied patch from Tracy Miranda (bug 86540: NPE in CProjectSourceLocation).

Check for the project and synchronization are added to "initializeFolders".
This commit is contained in:
Mikhail Khodjaiants 2005-02-24 23:25:56 +00:00
parent 6dc9b768e8
commit 1a8eee1a13
2 changed files with 28 additions and 14 deletions

View file

@ -1,3 +1,8 @@
2005-02-24 Mikhail Khodjaiants
Applied patch from Tracy Miranda (bug 86540: NPE in CProjectSourceLocation).
Check for the project and synchronization are added to "initializeFolders".
* CProjectSourceLocation.java
2005-02-22 Mikhail Khodjaiants
Bug 84799: Implement Memory View and renderings with new rendering APIs.
* CMemoryBlockExtensionRetrieval.java

View file

@ -186,18 +186,21 @@ public class CProjectSourceLocation implements IProjectSourceLocation
{
if ( list.size() > 0 && !searchForDuplicateFiles() )
break;
IPath path = folders[i].getLocation().append( fileName );
File file = new File( path.toOSString() );
if ( file.exists() )
{
IFile[] wsFiles = CDebugCorePlugin.getWorkspace().getRoot().findFilesForLocation( path );
for ( int j = 0; j < wsFiles.length; ++j )
if ( wsFiles[j].exists() )
{
if ( !searchForDuplicateFiles() )
return wsFiles[j];
list.add( wsFiles[j] );
}
IPath path = folders[i].getLocation();
if ( path != null ) {
path = path.append( fileName );
File file = new File( path.toOSString() );
if ( file.exists() )
{
IFile[] wsFiles = CDebugCorePlugin.getWorkspace().getRoot().findFilesForLocation( path );
for ( int j = 0; j < wsFiles.length; ++j )
if ( wsFiles[j].exists() )
{
if ( !searchForDuplicateFiles() )
return wsFiles[j];
list.add( wsFiles[j] );
}
}
}
}
return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null;
@ -351,7 +354,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation
private void initializeFolders()
{
final LinkedList list = new LinkedList();
if ( getProject() != null )
if ( getProject() != null && getProject().exists() )
{
list.add( getProject() );
try
@ -379,7 +382,13 @@ public class CProjectSourceLocation implements IProjectSourceLocation
{
}
}
fFolders = (IResource[])list.toArray( new IResource[list.size()] );
synchronized( this )
{
if ( fFolders == null )
{
fFolders = (IResource[])list.toArray( new IResource[list.size()] );
}
}
}
protected IResource[] getFolders()