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); } } }); } }
@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); } } }); } }
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); } }
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); } }
@Override public void queueTask(@NotNull DumbModeTask task) { task.performInDumbMode(new EmptyProgressIndicator()); Disposer.dispose(task); }
@Override public void cancelTask(@NotNull DumbModeTask task) { }
@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) { } }); }
@Override public void queueTask(@Nonnull DumbModeTask task) { task.performInDumbMode(new EmptyProgressIndicator()); Disposer.dispose(task); }
@Override public void cancelTask(@Nonnull DumbModeTask task) { }