1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36: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 2005-02-22 Mikhail Khodjaiants
Bug 84799: Implement Memory View and renderings with new rendering APIs. Bug 84799: Implement Memory View and renderings with new rendering APIs.
* CMemoryBlockExtensionRetrieval.java * CMemoryBlockExtensionRetrieval.java

View file

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