List of usage examples for com.intellij.openapi.actionSystem.ex ActionUtil isDumbMode
public static boolean isDumbMode(@Nullable Project project)
From source file:automation.RobotControl.java
License:Apache License
public void waitIdeaOpening(Runnable runnable, Project project) throws InterruptedException { robotThread.queueOfTasks.put((Computable) () -> { EdtInvocationManager.getInstance().invokeLater(new Runnable() { @Override/* ww w . j a v a 2 s .c o m*/ public void run() { if (ActionUtil.isDumbMode(project)) { try { robotThread.waitSome(2000, new Runnable() { @Override public void run() { EdtInvocationManager.getInstance().invokeLater(new Runnable() { @Override public void run() { try { waitIdeaOpening(runnable, project); } catch (InterruptedException e) { e.printStackTrace(); } } }); } }); } catch (InterruptedException e) { e.printStackTrace(); } } else { runnable.run(); } } }); return null; }); }
From source file:com.intellij.util.indexing.FileBasedIndexImpl.java
License:Apache License
protected <K> void ensureUpToDate(@NotNull final ID<K, ?> indexId, @Nullable Project project, @Nullable GlobalSearchScope filter, @Nullable VirtualFile restrictedFile) { ProgressManager.checkCanceled();/* w w w.j a v a2 s. com*/ myContentlessIndicesUpdateQueue.ensureUpToDate(); // some content full indices depends on contentless ones if (!needsFileContentLoading(indexId)) { return; //indexed eagerly in foreground while building unindexed file list } if (filter == GlobalSearchScope.EMPTY_SCOPE) { return; } if (ActionUtil.isDumbMode(project)) { handleDumbMode(project); } if (myReentrancyGuard.get().booleanValue()) { //assert false : "ensureUpToDate() is not reentrant!"; return; } myReentrancyGuard.set(Boolean.TRUE); try { myChangedFilesCollector.tryToEnsureAllInvalidateTasksCompleted(); if (isUpToDateCheckEnabled()) { try { checkRebuild(indexId, false); myChangedFilesCollector.forceUpdate(project, filter, restrictedFile); indexUnsavedDocuments(indexId, project, filter, restrictedFile); } catch (StorageException e) { scheduleRebuild(indexId, e); } catch (RuntimeException e) { final Throwable cause = e.getCause(); if (cause instanceof StorageException || cause instanceof IOException) { scheduleRebuild(indexId, e); } else { throw e; } } } } finally { myReentrancyGuard.set(Boolean.FALSE); } }