Search in sources :

Example 1 with DumbModeTask

use of com.intellij.openapi.project.DumbModeTask in project intellij-community by JetBrains.

the class ToggleDumbModeAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    if (myDumb) {
        myDumb = false;
    } else {
        myDumb = true;
        final Project project = e.getProject();
        if (project == null)
            return;
        DumbServiceImpl.getInstance(project).queueTask(new DumbModeTask() {

            @Override
            public void performInDumbMode(@NotNull ProgressIndicator indicator) {
                while (myDumb) {
                    indicator.checkCanceled();
                    TimeoutUtil.sleep(100);
                }
            }
        });
    }
}
Also used : Project(com.intellij.openapi.project.Project) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) DumbModeTask(com.intellij.openapi.project.DumbModeTask)

Example 2 with DumbModeTask

use of com.intellij.openapi.project.DumbModeTask in project intellij-community by JetBrains.

the class ProjectRootManagerComponent method doUpdateOnRefresh.

private void doUpdateOnRefresh() {
    if (ApplicationManager.getApplication().isUnitTestMode() && (!myStartupActivityPerformed || myProject.isDisposed())) {
        // in test mode suppress addition to a queue unless project is properly initialized
        return;
    }
    if (myProject.isDefault()) {
        return;
    }
    if (myDoLogCachesUpdate)
        LOG.debug("refresh");
    DumbServiceImpl dumbService = DumbServiceImpl.getInstance(myProject);
    DumbModeTask task = FileBasedIndexProjectHandler.createChangedFilesIndexingTask(myProject);
    if (task != null) {
        dumbService.queueTask(task);
    }
}
Also used : DumbModeTask(com.intellij.openapi.project.DumbModeTask) DumbServiceImpl(com.intellij.openapi.project.DumbServiceImpl)

Aggregations

DumbModeTask (com.intellij.openapi.project.DumbModeTask)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 DumbServiceImpl (com.intellij.openapi.project.DumbServiceImpl)1 Project (com.intellij.openapi.project.Project)1