Project: Eclipse_Platform_UI
Bug 11107 Action filter asking closed project for natures
Reported: 2002-03-11 12:58:07 | Status: resolved fixed

IProject#hasNature(String) is spec'ed to throw an exception if the project is closed, and I recently fixed the implementation to match this. WorkbenchProject#testAttribute calls this method when filtering actions, and as a result, many CoreExceptions are now thrown when a user right-clicks on a closed project in the navigator. These exceptions don't surface because the code in WorkbenchProject currently swallows the exception. However, it would be good to fix the UI code to avoid the overhead of all these exceptions (exception and status objects created, message binding, throw/catch overhead, etc). I recommend: } else if (name.equals(PROJECT_NATURE)) { try { IProject proj = res.getProject(); return proj.isAccessible() && proj.hasNature(value); } catch (CoreException e) { return false; } }

Files changed in fix:
bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchProject.java bundles/org.eclipse.ui/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchResource.java