@Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask("", IProgressMonitor.UNKNOWN); // $NON-NLS-1$ while (true) { ICProject cproject = fManager.getNextProject(); if (cproject == null) return Status.OK_STATUS; final IProject project = cproject.getProject(); monitor.setTaskName(project.getName()); if (!project.isOpen()) { if (fManager.fTraceIndexerSetup) System.out.println("Indexer: Project is not open: " + project.getName()); // $NON-NLS-1$ } else if (fManager.postponeSetup(cproject)) { if (fManager.fTraceIndexerSetup) System.out.println("Indexer: Setup is postponed: " + project.getName()); // $NON-NLS-1$ } else { syncronizeProjectSettings(project, new SubProgressMonitor(monitor, 1)); if (fManager.getIndexer(cproject) == null) { try { fManager.createIndexer(cproject, new SubProgressMonitor(monitor, 99)); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return Status.CANCEL_STATUS; } } else if (fManager.fTraceIndexerSetup) { System.out.println( "Indexer: No action, indexer already exists: " + project.getName()); // $NON-NLS-1$ } } } }
private void syncronizeProjectSettings(IProject project, IProgressMonitor monitor) { try { IFolder settings = project.getFolder(SETTINGS_FOLDER_NAME); settings.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (CoreException e) { CCorePlugin.log(e); } monitor.done(); }