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


Java ProgressManager.run方法代码示例

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


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

示例1: doSynchronously

import com.intellij.openapi.progress.ProgressManager; //导入方法依赖的package包/类
/**
 * Execute simple process synchronously with progress
 *
 * @param handler        a handler
 * @param operationTitle an operation title shown in progress dialog
 * @param operationName  an operation name shown in failure dialog
 * @return An exit code
 */
public static int doSynchronously(final GitLineHandler handler, final String operationTitle, @NonNls final String operationName) {
  final ProgressManager manager = ProgressManager.getInstance();
  manager.run(new Task.Modal(handler.project(), operationTitle, true) {
    public void run(@NotNull final ProgressIndicator indicator) {
      handler.addLineListener(new GitLineHandlerListenerProgress(indicator, handler, operationName, true));
      runInCurrentThread(handler, indicator, true, operationTitle);
    }
  });
  if (!handler.isStarted()) {
    return -1;
  }
  return handler.getExitCode();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitHandlerUtil.java

示例2: loadBranches

import com.intellij.openapi.progress.ProgressManager; //导入方法依赖的package包/类
@Nullable
private void loadBranches(final String selectedBranchesHolder, final Runnable runnable) {
  final ProgressManager pm = ProgressManager.getInstance();
  pm.run(new ModalityIgnorantBackgroundableTask(myProject, SvnBundle.message("compare.with.branch.progress.loading.branches")) {
    @Override
    protected void doInAwtIfFail(Exception e) {
      runnable.run();
    }

    @Override
    protected void doInAwtIfCancel() {
      runnable.run();
    }

    @Override
    protected void doInAwtIfSuccess() {
      runnable.run();
    }

    @Override
    protected void runImpl(@NotNull ProgressIndicator indicator) {
      final NewRootBunch manager = SvnBranchConfigurationManager.getInstance(myProject).getSvnBranchConfigManager();

      manager.reloadBranches(myVcsRoot, selectedBranchesHolder, InfoReliability.setByUser, false);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:SelectBranchPopup.java

示例3: loadList

import com.intellij.openapi.progress.ProgressManager; //导入方法依赖的package包/类
private void loadList(DefaultTableModel tblIssueModel, ProgressManager manager) {
    pnlMain.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    Task task =
            new Task.Backgroundable(Helper.getProject(), "Load Issues...", true) {
                @Override
                public void run(@NotNull ProgressIndicator progressIndicator) {
                    try {
                        controlPagination();
                        if(!settings.validateSettings()) {
                            Helper.printNotification("Wrong settings!", "The connection-settings are incorrect!", NotificationType.WARNING);
                            state = false;
                            tblIssues.removeAll();
                            for (int i = tblIssueModel.getRowCount() - 1; i >= 0; i--) {
                                tblIssueModel.removeRow(i);
                            }
                        } else {

                            state = true;
                            tblIssues.removeAll();
                            for (int i = tblIssueModel.getRowCount() - 1; i >= 0; i--) {
                                tblIssueModel.removeRow(i);
                            }
                            tblIssues.setModel(tblIssueModel);
                            String filterID = "";
                            if(cmbFilters.getSelectedItem()!=null) {
                                if(!cmbFilters.getSelectedItem().toString().equals("")) {
                                    filterID = cmbFilters.getSelectedItem().toString().split(":")[0].trim();
                                }
                            }
                            List<MantisIssue> mantisIssues = new MantisSoapAPI(settings).getIssues(settings.getProjectID(), page, filterID);
                            progressIndicator.setFraction(0.0);
                            double factor = 100.0 / mantisIssues.size();
                            for(MantisIssue issue : mantisIssues) {
                                tblIssueModel.addRow(new Object[]{issue.getId(), issue.getSummary(), issue.getStatus()});
                                progressIndicator.setFraction(progressIndicator.getFraction() + factor);
                            }
                            tblIssues.setModel(tblIssueModel);
                            cmdIssueNew.setEnabled(true);
                        }
                    } catch (Exception ex) {
                        Helper.printException(ex);
                    } finally {
                        pnlMain.setCursor(Cursor.getDefaultCursor());
                    }
                }
            };
    manager.run(task);
}
 
开发者ID:domjos1994,项目名称:ideaMantis,代码行数:49,代码来源:IdeaMantisIssues.java

示例4: createVirtualEnv

import com.intellij.openapi.progress.ProgressManager; //导入方法依赖的package包/类
public void createVirtualEnv(final VirtualEnvCallback callback) {
  final ProgressManager progman = ProgressManager.getInstance();
  final Sdk basicSdk = getSdk();
  final Task.Modal createTask = new Task.Modal(myProject, PyBundle.message("sdk.create.venv.dialog.creating.venv"), false) {
    String myPath;

    public void run(@NotNull final ProgressIndicator indicator) {

      try {
        indicator.setText(PyBundle.message("sdk.create.venv.dialog.creating.venv"));
        myPath = createEnvironment(basicSdk);
      }
      catch (final ExecutionException e) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            final PackageManagementService.ErrorDescription description =
              PyPackageManagementService.toErrorDescription(Collections.singletonList(e), basicSdk);
            if (description != null) {
              PackagesNotificationPanel.showError(PyBundle.message("sdk.create.venv.dialog.error.failed.to.create.venv"), description);
            }
          }
        }, ModalityState.any());
      }
    }


    @Override
    public void onSuccess() {
      if (myPath != null) {
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
              @Override
              public void run() {
                setupVirtualEnvSdk(myPath, associateWithProject(), callback);
              }
            });
          }
        });
      }
    }
  };
  progman.run(createTask);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:AbstractCreateVirtualEnvDialog.java


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