Community
Participate
Working Groups
3.5 RC4 See bug#273385 comment#15. Currently, org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(IResourceChangeEvent) does not react to IResourceChangeEvent.PRE_CLOSE notification at all. This defect is raised to track the investigation and implementation of the right behavior in response to this event.
Jay, can you please follow up ? Thanks.
Created attachment 157579 [details] Proposed Patch I think the only thing we need to do for PRE_CLOSE is to discard the jobs. Here are my reasons why we don't need the other things mentioned in bug#273385 comment#15: The DeltraProcessor#oldRoots doesn't seem to be used in any where during the close event. In fact I don't find it being used for project delete either. But that may not be in the scope of this bug. The rest of the things done inside DeltaProcessor#deleting() either don't make sense in the context of PRE_CLOSE (like project.close() or invoked later during the POST_CHANGE event (see DeltaProcessor#checkProjectsAndClasspathChanges). No regression test is included. To test, fire and hold a non-blocking job (like indexing) and firing the close event.
Should not we also check the nature of the project before discarding its jobs ? case IResourceChangeEvent.PRE_CLOSE: if(resource.getType() == IResource.PROJECT && ((IProject) resource).hasNature(JavaCore.NATURE_ID)) { this.manager.indexManager.discardJobs(((IProject) resource).getName()); } return; Beside this, the patch looks good. Tagging as 3.6M6. Jay, please release.
Looks like we already have the code in place for discarding jobs as well. It's here - DeltaProcessor#checkProjectsAndClasspathChanges line number 2446. I don't know how I missed this the first time. Nevertheless it's there and effectively, we seem to have all the code in place already!
I am not sure that code is triggered on project close event.
(In reply to comment #5) > I am not sure that code is triggered on project close event. It is, indeed. When a project is closed, POST_CHANGE event is triggered, which eventually results in this code being invoked: if (res.isOpen()) { ... } else { boolean wasJavaProject = this.state.findJavaProject(res.getName()) != null; if (wasJavaProject) { close(element); removeFromParentInfo(element); currentDelta().closed(element); this.manager.indexManager.discardJobs(element.getElementName()); this.manager.indexManager.removeIndexFamily(res.getFullPath()); } } The line number I mentioned wasn't exactly correct, perhaps because I had the previous patch applied.
Then this can be closed as INVALID.
As mentioned in comment 2 comment 4 and comment 6, we need not do anything for PRE_CLOSE event. Marking as INVALID.
Verified for 3.6M6
Verified.