startIndexing();
// process deltas since last activated in indexer thread so that indexes are up-to-date.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
Job processSavedState = new Job(Messages.savedState_jobName) {
protected IStatus run(IProgressMonitor monitor) {
try {
// add save participant and process delta atomically
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
workspace.run(
new IWorkspaceRunnable() {
public void run(IProgressMonitor progress) throws CoreException {
ISavedState savedState = workspace.addSaveParticipant(JavaCore.getJavaCore(), JavaModelManager.this);
if (savedState != null) {
// the event type coming from the saved state is always POST_AUTO_BUILD
// force it to be POST_CHANGE so that the delta processor can handle it
JavaModelManager.this.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
savedState.processResourceChangeEvents(JavaModelManager.this.deltaState);
}
}
},
monitor);
} catch (CoreException e) {
return e.getStatus();
}
return Status.OK_STATUS;
}
};
processSavedState.setSystem(true);
processSavedState.setPriority(Job.SHORT); // process asap
processSavedState.schedule();
} catch (RuntimeException e) {
shutdown();
throw e;
}
}