@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$ } } } }
public void done(IJobChangeEvent event) { if (event.getJob().belongsTo(fPDomManager)) { if (Job.getJobManager().find(fPDomManager).length == 0) { fPDomManager.fireStateChange(IndexerStateEvent.STATE_IDLE); } } }
private void reindex(String cfgId, ILanguageSettingsChangeEvent event) { CModelManager manager = CModelManager.getDefault(); ICProject cProject = manager.getCModel().getCProject(event.getProjectName()); Set<ICElement> tuSelection = new HashSet<ICElement>(); Set<IResource> resources = event.getAffectedResources(cfgId); if (resources != null && !resources.isEmpty()) { for (IResource rc : resources) { tuSelection.add(manager.create(rc, cProject)); } try { fManager.update( tuSelection.toArray(new ICElement[tuSelection.size()]), IIndexManager.UPDATE_ALL); } catch (CoreException e) { CCorePlugin.log(e); } } }
public void scheduled(IJobChangeEvent event) { if (event.getJob().belongsTo(fPDomManager)) { fPDomManager.fireStateChange(IndexerStateEvent.STATE_BUSY); } }