当前位置: 首页>>代码示例>>Java>>正文


Java ProgressIndicator.start方法代码示例

本文整理汇总了Java中com.intellij.openapi.progress.ProgressIndicator.start方法的典型用法代码示例。如果您正苦于以下问题:Java ProgressIndicator.start方法的具体用法?Java ProgressIndicator.start怎么用?Java ProgressIndicator.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.progress.ProgressIndicator的用法示例。


在下文中一共展示了ProgressIndicator.start方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChildren

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@Override
@NotNull
public Collection<? extends AbstractTreeNode> getChildren() {
  ProgressIndicator current = ProgressManager.getInstance().getProgressIndicator();
  ProgressIndicator indicator = current == null ? new ProgressIndicatorBase() : current;
  if (current == null) {
    indicator.start();
  }
  final Collection[] nodes = new Collection[1];
  ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() {
    @Override
    public void run() {
      nodes[0] = getChildrenUnderProgress(ProgressManager.getInstance().getProgressIndicator());
    }
  }, indicator);
  if (current == null) {
    indicator.stop();
  }
  return nodes[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SliceNode.java

示例2: perform

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@NotNull
@Override
protected File perform(@NotNull ProgressIndicator indicator, @NotNull File file) throws WizardException {
  indicator.setText("Moving downloaded SDK");
  indicator.start();
  try {
    File root = getSdkRoot(file);
    if (!root.renameTo(myDestination)) {
      FileUtil.copyDir(root, myDestination);
      FileUtil.delete(root); // Failure to delete it is not critical, the source is in temp folder.
      // No need to abort installation.
    }
    return myDestination;
  }
  catch (IOException e) {
    throw new WizardException("Unable to move Android SDK", e);
  }
  finally {
    indicator.setFraction(1.0);
    indicator.stop();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:InstallComponentsPath.java

示例3: perform

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@Override
@NotNull
protected File perform(@NotNull ProgressIndicator indicator, @NotNull File arg) throws WizardException, InstallationCancelledException {
  File file = new File(myContext.getTempDirectory(), getFileName(myUrl));
  myContext.print(String.format("Downloading %1$s from %2$s\n", file.getName(), myUrl), ConsoleViewContentType.SYSTEM_OUTPUT);
  indicator.start();
  try {
    //noinspection StatementWithEmptyBody
    while (!attemptDownload(file, indicator)) {
      // Nothing to do
    }
    return file;
  }
  catch (ProcessCanceledException e) {
    throw new InstallationCancelledException();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DownloadOperation.java

示例4: executeOnPooledThread

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
@CalledInAwt
@NotNull
public static ProgressIndicator executeOnPooledThread(@NotNull final Consumer<ProgressIndicator> task, @NotNull Disposable parent) {
  final ModalityState modalityState = ModalityState.current();
  final ProgressIndicator indicator = new EmptyProgressIndicator() {
    @NotNull
    @Override
    public ModalityState getModalityState() {
      return modalityState;
    }
  };
  indicator.start();

  final Disposable disposable = new Disposable() {
    @Override
    public void dispose() {
      if (indicator.isRunning()) indicator.cancel();
    }
  };
  Disposer.register(parent, disposable);

  ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
    @Override
    public void run() {
      ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() {
        @Override
        public void run() {
          try {
            task.consume(indicator);
          }
          finally {
            indicator.stop();
            Disposer.dispose(disposable);
          }
        }
      }, indicator);
    }
  });

  return indicator;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:BackgroundTaskUtil.java

示例5: untar

import com.intellij.openapi.progress.ProgressIndicator; //导入方法依赖的package包/类
/**
 * @throws IOException     when tar fails in a way that we may retry the operation
 * @throws WizardException if retry is not possible (e.g. no tar executable)
 */
@NotNull
private static File untar(final File archive, File destination, final InstallContext context, final ProgressIndicator indicator)
  throws IOException, WizardException {
  if (!destination.mkdirs()) {
    throw new WizardException("Cannot create temporary directory to extract files");
  }
  indicator.start();
  indicator.setFraction(0.0); // 0%
  try {
    GeneralCommandLine line =
      new GeneralCommandLine(getTarExecutablePath(), TAR_FLAGS_EXTRACT_UNPACK_VERBOSE_FILENAME_TARGETDIR, archive.getAbsolutePath(),
                             destination.getAbsolutePath());
    CapturingAnsiEscapesAwareProcessHandler handler = new CapturingAnsiEscapesAwareProcessHandler(line);
    handler.addProcessListener(new ProcessAdapter() {
      @Override
      public void onTextAvailable(ProcessEvent event, Key outputType) {
        String string = event.getText();
        if (!StringUtil.isEmptyOrSpaces(string)) {
          if (string.startsWith(EXTRACT_OPERATION_OUTPUT)) { // Extract operation prefix
            String fileName = string.substring(EXTRACT_OPERATION_OUTPUT.length()).trim();
            indicator.setText(fileName);
          }
          else if (ProcessOutputTypes.STDOUT.equals(outputType)) {
            indicator.setText(string.trim());
          }
          else {
            context.print(string, ConsoleViewContentType.getConsoleViewType(outputType));
          }
        }
      }
    });
    if (handler.runProcess().getExitCode() != 0) {
      throw new IOException("Unable to unpack archive file");
    }
    return destination;
  }
  catch (ExecutionException e) {
    throw new WizardException("Unable to run tar utility");
  }
  finally {
    indicator.setFraction(1.0); // 100%
    indicator.stop();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:UnpackOperation.java


注:本文中的com.intellij.openapi.progress.ProgressIndicator.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。