本文整理汇总了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();
}
示例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);
}
});
}
示例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);
}
示例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);
}