diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index 9ea0a8b36b6..854c0156b79 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,18 @@ +2004-04-15 Alain Magloire + + Fix for PR 58481 + Since TypeInfo shares have some common code + with the Search the fix was put in the search to. + The fix is to check the accessibility of the project + before introspecting it, it may have been deleted. + + * browser/org/eclipse/cdt/internal/core/browser/cache/TypeMatchLocator.java + * search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java + + Remove the synchronized it is not necessary and causes + deadlocks. + * model/org/eclipse/cdt/internal/core/model/Openable.java + 2004-04-14 Alain Magloire This is temporary 'till we get the fancy ICType scheme diff --git a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeMatchLocator.java b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeMatchLocator.java index 8ec78a7f15c..a1965b6d8b7 100644 --- a/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeMatchLocator.java +++ b/core/org.eclipse.cdt.core/browser/org/eclipse/cdt/internal/core/browser/cache/TypeMatchLocator.java @@ -432,14 +432,22 @@ public class TypeMatchLocator implements ISourceElementRequestor, ICSearchConsta workingCopy= (IWorkingCopy) workingCopyMap.get(path); if (workingCopy != null) { currentResource= workingCopy.getResource(); - reader= new CharArrayReader(workingCopy.getContents()); + if (currentResource != null && currentResource.isAccessible()) { + reader= new CharArrayReader(workingCopy.getContents()); + } else { + continue; + } } else { currentResource= workspaceRoot.findMember(path, true); - if (currentResource != null && currentResource instanceof IFile) { - IFile file= (IFile) currentResource; - try { - reader= new InputStreamReader(file.getContents()); - } catch (CoreException ex) { + if (currentResource != null) { + if (currentResource.isAccessible() && currentResource instanceof IFile) { + IFile file= (IFile) currentResource; + try { + reader= new InputStreamReader(file.getContents()); + } catch (CoreException ex) { + continue; + } + } else { continue; } } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Openable.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Openable.java index 2db623d2297..f69f97a6179 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Openable.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/Openable.java @@ -198,9 +198,7 @@ public abstract class Openable extends Parent implements IOpenable, IBufferChang * @see org.eclipse.cdt.core.model.IOpenable#isOpen() */ public boolean isOpen() { - synchronized(CModelManager.getDefault()){ - return CModelManager.getDefault().getInfo(this) != null; - } + return CModelManager.getDefault().getInfo(this) != null; } /** diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java index f197fc8d0fb..72b863d72d9 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java @@ -397,19 +397,27 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants IWorkingCopy workingCopy = (IWorkingCopy)wcPaths.get( pathString ); if( workingCopy != null ){ - reader = new CharArrayReader( workingCopy.getContents() ); currentResource = workingCopy.getResource(); - realPath = currentResource.getLocation(); - project = currentResource.getProject(); + if ( currentResource != null && currentResource.isAccessible() ) { + reader = new CharArrayReader( workingCopy.getContents() ); + realPath = currentResource.getLocation(); + project = currentResource.getProject(); + } else { + continue; + } } else { currentResource = workspaceRoot.findMember( pathString, true ); try{ - if( currentResource != null && currentResource instanceof IFile ){ - IFile file = (IFile) currentResource; - reader = new InputStreamReader( file.getContents() ); - realPath = currentResource.getLocation(); - project = file.getProject(); + if( currentResource != null ){ + if (currentResource.isAccessible() && currentResource instanceof IFile) { + IFile file = (IFile) currentResource; + reader = new InputStreamReader( file.getContents() ); + realPath = currentResource.getLocation(); + project = file.getProject(); + } else { + continue; + } } } catch ( CoreException e ){ continue;