Search in sources :

Example 1 with GradleTasksExecutor

use of com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor in project android by JetBrains.

the class GradleSyncInvoker method isBuildInProgress.

private static boolean isBuildInProgress(@NotNull Project project) {
    IdeFrame frame = ((WindowManagerEx) WindowManager.getInstance()).findFrameFor(project);
    StatusBarEx statusBar = frame == null ? null : (StatusBarEx) frame.getStatusBar();
    if (statusBar == null) {
        return false;
    }
    for (Pair<TaskInfo, ProgressIndicator> backgroundProcess : statusBar.getBackgroundProcesses()) {
        TaskInfo task = backgroundProcess.getFirst();
        if (task instanceof GradleTasksExecutor) {
            ProgressIndicator second = backgroundProcess.getSecond();
            if (second.isRunning()) {
                return true;
            }
        }
    }
    return false;
}
Also used : TaskInfo(com.intellij.openapi.progress.TaskInfo) GradleTasksExecutor(com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) IdeFrame(com.intellij.openapi.wm.IdeFrame) WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx)

Aggregations

GradleTasksExecutor (com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 TaskInfo (com.intellij.openapi.progress.TaskInfo)1 IdeFrame (com.intellij.openapi.wm.IdeFrame)1 StatusBarEx (com.intellij.openapi.wm.ex.StatusBarEx)1 WindowManagerEx (com.intellij.openapi.wm.ex.WindowManagerEx)1