Java Code Examples for com.intellij.openapi.progress.ProgressIndicator#popState()

The following examples show how to use com.intellij.openapi.progress.ProgressIndicator#popState() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompileDriver.java    From consulo with Apache License 2.0 6 votes vote down vote up
private boolean executeCompileTasks(final CompileContext context, final boolean beforeTasks) {
  final CompilerManager manager = CompilerManager.getInstance(myProject);
  final ProgressIndicator progressIndicator = context.getProgressIndicator();
  progressIndicator.pushState();
  try {
    CompileTask[] tasks = beforeTasks ? manager.getBeforeTasks() : manager.getAfterTasks();
    if (tasks.length > 0) {
      progressIndicator.setText(beforeTasks ? CompilerBundle.message("progress.executing.precompile.tasks") : CompilerBundle.message("progress.executing.postcompile.tasks"));
      for (CompileTask task : tasks) {
        if (!task.execute(context)) {
          return false;
        }
      }
    }
  }
  finally {
    progressIndicator.popState();
    WindowManager.getInstance().getStatusBar(myProject).setInfo("");
  }
  return true;
}
 
Example 2
Source File: JarHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private File copyToMirror(@Nonnull File original, @Nonnull File mirror) {
  ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
  if (progress != null) {
    progress.pushState();
    progress.setText(VfsBundle.message("jar.copy.progress", original.getPath()));
    progress.setFraction(0);
  }

  try {
    FileUtil.copy(original, mirror);
  }
  catch (final IOException e) {
    reportIOErrorWithJars(original, mirror, e);
    return original;
  }
  finally {
    if (progress != null) {
      progress.popState();
    }
  }


  return mirror;
}
 
Example 3
Source File: MikTaskBase.java    From markdown-image-kit with MIT License 5 votes vote down vote up
@Override
public void run(@NotNull ProgressIndicator indicator) {
    indicator.pushState();
    indicator.setIndeterminate(false);
    try {
        indicator.setFraction(0.0);
        manager.invoke(indicator);
    } finally {
        indicator.setFraction(1.0);
        indicator.popState();
    }
}