use of com.intellij.openapi.progress.ProgressIndicator in project buck by facebook.
the class BuckBuildManager method runBuckCommand.
/**
* Execute simple process asynchronously with progress.
*
* @param handler a handler
* @param operationTitle an operation title shown in progress dialog
*/
public synchronized void runBuckCommand(final BuckCommandHandler handler, final String operationTitle) {
if (!(handler instanceof BuckKillCommandHandler)) {
currentRunningBuckCommandHandler = handler;
// Save files for anything besides buck kill
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
FileDocumentManager.getInstance().saveAllDocuments();
}
}, ModalityState.NON_MODAL);
}
Project project = handler.project();
String exec = BuckSettingsProvider.getInstance().getState().buckExecutable;
if (exec == null) {
BuckToolWindowFactory.outputConsoleMessage(project, "Please specify the buck executable path!\n", ConsoleViewContentType.ERROR_OUTPUT);
BuckToolWindowFactory.outputConsoleMessage(project, "Preference -> Tools -> Buck -> Path to Buck executable\n", ConsoleViewContentType.NORMAL_OUTPUT);
return;
}
final ProgressManager manager = ProgressManager.getInstance();
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
manager.run(new Task.Backgroundable(handler.project(), operationTitle, true) {
public void run(final ProgressIndicator indicator) {
runInCurrentThread(handler, indicator, true, operationTitle);
}
});
}
});
}
use of com.intellij.openapi.progress.ProgressIndicator in project buck by facebook.
the class TestExecutionState method showProgress.
private void showProgress(final OSProcessHandler result, final String title) {
final ProgressManager manager = ProgressManager.getInstance();
ApplicationManager.getApplication().invokeLater(() -> {
manager.run(new Task.Backgroundable(mProject, title, true) {
public void run(@NotNull final ProgressIndicator indicator) {
try {
result.waitFor();
} finally {
indicator.cancel();
}
}
});
});
}
use of com.intellij.openapi.progress.ProgressIndicator in project intellij-plugins by StepicOrg.
the class StepikSendAction method check.
private void check(@NotNull Project project) {
logger.info("Start checking step");
StudyNode<?, ?> selected = StepikProjectManager.getSelected(project);
if (!(selected instanceof StepNode)) {
logger.info("Stop checking step: step is null or is not StepNode ");
return;
}
StepNode stepNode = (StepNode) selected;
String title = "Checking Step: " + stepNode.getName();
ProgressManager.getInstance().run(new Task.Backgroundable(project, title) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
indicator.setIndeterminate(true);
StepikApiClient stepikApiClient = authAndGetStepikApiClient(true);
if (!isAuthenticated()) {
return;
}
Long submissionId = sendStep(stepikApiClient, project, stepNode);
if (submissionId == null) {
return;
}
Metrics.sendAction(project, stepNode, SUCCESSFUL);
SendAction.checkStepStatus(project, stepikApiClient, stepNode, submissionId, indicator);
logger.info(String.format("Finish checking step: id=%s", stepNode.getId()));
}
});
}
use of com.intellij.openapi.progress.ProgressIndicator in project intellij-community by JetBrains.
the class SvnAuthenticationNotifier method clearAuthenticationDirectory.
public static void clearAuthenticationDirectory(@NotNull SvnConfiguration configuration) {
final File authDir = new File(configuration.getConfigurationDirectory(), "auth");
if (authDir.exists()) {
final Runnable process = () -> {
final ProgressIndicator ind = ProgressManager.getInstance().getProgressIndicator();
if (ind != null) {
ind.setIndeterminate(true);
ind.setText("Clearing stored credentials in " + authDir.getAbsolutePath());
}
final File[] files = authDir.listFiles((dir, name) -> ourAuthKinds.contains(name));
for (File dir : files) {
if (ind != null) {
ind.setText("Deleting " + dir.getAbsolutePath());
}
FileUtil.delete(dir);
}
};
final Application application = ApplicationManager.getApplication();
if (application.isUnitTestMode() || !application.isDispatchThread()) {
process.run();
} else {
ProgressManager.getInstance().runProcessWithProgressSynchronously(process, "button.text.clear.authentication.cache", false, configuration.getProject());
}
}
}
use of com.intellij.openapi.progress.ProgressIndicator in project intellij-community by JetBrains.
the class SvnCheckoutProvider method doExport.
public static void doExport(final Project project, final File target, final SVNURL url, final Depth depth, final boolean ignoreExternals, final boolean force, final String eolStyle) {
try {
final VcsException[] exception = new VcsException[1];
final SvnVcs vcs = SvnVcs.getInstance(project);
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
ProgressTracker handler = new CheckoutEventHandler(vcs, true, progressIndicator);
try {
progressIndicator.setText(message("progress.text.export", target.getAbsolutePath()));
SvnTarget from = SvnTarget.fromURL(url);
ExportClient client = vcs.getFactoryFromSettings().createExportClient();
client.export(from, target, SVNRevision.HEAD, depth, eolStyle, force, ignoreExternals, handler);
} catch (VcsException e) {
exception[0] = e;
}
}, message("message.title.export"), true, project);
if (exception[0] != null) {
throw exception[0];
}
} catch (VcsException e1) {
showErrorDialog(message("message.text.cannot.export", e1.getMessage()), message("message.title.export"));
}
}
Aggregations