void (final @NotNull String remoteName, final @NotNull String remoteUrl) { ProgressManager.getInstance() .run(new Task.Modal(myRepository.getProject(), GitBundle.message("push.dialog.target.panel.adding.remote"), true) { private GitCommandResult myResult; @Override public void run(@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); myResult = myGit.addRemote(myRepository, remoteName, remoteUrl); myRepository.update(); } @Override public void onSuccess() { if (myResult.success()) { updateComponents(myPushSupport.getDefaultTarget(myRepository, mySource)); if (myFireOnChangeAction != null) { myFireOnChangeAction.run(); } } else { String message = GitBundle.message("push.dialog.target.panel.couldnt.add.remote", myResult.getErrorOutputAsHtmlString()); LOG.warn(message); Messages.showErrorDialog(myProject, XmlStringUtil.wrapInHtml(message), GitBundle.message("push.dialog.target.panel.add.remote")); } } }); }