Java 类com.intellij.openapi.project.DumbModeTask 实例源码

项目:intellij-ce-playground    文件:ToggleDumbModeAction.java   
public void actionPerformed(final AnActionEvent e) {
  if (myDumb) {
    myDumb = false;
  }
  else {
    myDumb = true;
    final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
    if (project == null) return;

    DumbServiceImpl.getInstance(project).queueTask(new DumbModeTask() {
      @Override
      public void performInDumbMode(@NotNull ProgressIndicator indicator) {
        while (myDumb) {
          indicator.checkCanceled();
          TimeoutUtil.sleep(100);
        }
      }
    });
  }
}
项目:consulo    文件:ToggleDumbModeAction.java   
@Override
public void actionPerformed(final AnActionEvent e) {
  if (myDumb) {
    myDumb = false;
  }
  else {
    myDumb = true;
    final Project project = e.getData(CommonDataKeys.PROJECT);
    if (project == null) return;

    DumbServiceImpl.getInstance(project).queueTask(new DumbModeTask() {
      @Override
      public void performInDumbMode(@Nonnull ProgressIndicator indicator) {
        while (myDumb) {
          indicator.checkCanceled();
          TimeoutUtil.sleep(100);
        }
      }
    });
  }
}
项目:intellij-ce-playground    文件:ProjectRootManagerComponent.java   
private void doUpdateOnRefresh() {
  if (ApplicationManager.getApplication().isUnitTestMode() && (!myStartupActivityPerformed || myProject.isDisposed())) {
    return; // in test mode suppress addition to a queue unless project is properly initialized
  }
  if (myProject.isDefault()) {
    return;
  }

  if (myDoLogCachesUpdate) LOG.info("refresh");
  DumbServiceImpl dumbService = DumbServiceImpl.getInstance(myProject);
  DumbModeTask task = FileBasedIndexProjectHandler.createChangedFilesIndexingTask(myProject);
  if (task != null) {
    dumbService.queueTask(task);
  }
}
项目:consulo    文件:ProjectRootManagerComponent.java   
private void doUpdateOnRefresh() {
  if (ApplicationManager.getApplication().isUnitTestMode() && (!myStartupActivityPerformed || myProject.isDisposed())) {
    return; // in test mode suppress addition to a queue unless project is properly initialized
  }
  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);
  }
}
项目:intellij-ce-playground    文件:MockDumbService.java   
@Override
public void queueTask(@NotNull DumbModeTask task) {
  task.performInDumbMode(new EmptyProgressIndicator());
  Disposer.dispose(task);
}
项目:intellij-ce-playground    文件:MockDumbService.java   
@Override
public void cancelTask(@NotNull DumbModeTask task) { }
项目:consulo    文件:CompositeFilterTest.java   
@Before
public void setUp() throws Exception {
  myCompositeFilter = new CompositeFilter(new DumbService() {
    @Override
    public ModificationTracker getModificationTracker() {
      return null;
    }

    @Override
    public boolean isDumb() {
      return false;
    }

    @Override
    public void runWhenSmart(Runnable runnable) {
    }

    @Override
    public void waitForSmartMode() {
    }

    @Override
    public void smartInvokeLater(@Nonnull Runnable runnable) {

    }

    @Override
    public void smartInvokeLater(@Nonnull Runnable runnable, @Nonnull ModalityState modalityState) {

    }

    @Override
    public void queueTask(@Nonnull DumbModeTask task) {

    }

    @Override
    public void cancelTask(@Nonnull DumbModeTask task) {

    }

    @Override
    public void completeJustSubmittedTasks() {

    }

    @Override
    public JComponent wrapGently(@Nonnull JComponent dumbUnawareContent, @Nonnull Disposable parentDisposable) {
      return null;
    }

    @Override
    public void showDumbModeNotification(String message) {
    }

    @Override
    public Project getProject() {
      return null;
    }

    @Override
    public void setAlternativeResolveEnabled(boolean enabled) {

    }

    @Override
    public boolean isAlternativeResolveEnabled() {
      return false;
    }

    @Override
    public void suspendIndexingAndRun(@Nonnull String activityName, @Nonnull Runnable activity) {

    }
  });
}
项目:consulo    文件:MockDumbService.java   
@Override
public void queueTask(@Nonnull DumbModeTask task) {
  task.performInDumbMode(new EmptyProgressIndicator());
  Disposer.dispose(task);
}
项目:consulo    文件:MockDumbService.java   
@Override
public void cancelTask(@Nonnull DumbModeTask task) {
}