From f3b7c57bd099331d1d2d6036a1d91703b24f7a6c Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Wed, 2 Mar 2016 19:47:23 +0300 Subject: [PATCH] [hg] execute mq delete in current thread --- .../hg4idea/command/mq/HgQDeleteCommand.java | 24 +++++++------------ .../hg4idea/ui/HgMqUnAppliedPatchesPanel.java | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQDeleteCommand.java b/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQDeleteCommand.java index e98def1bad52..204bfda3b8fd 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQDeleteCommand.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/command/mq/HgQDeleteCommand.java @@ -18,11 +18,9 @@ package org.zmlx.hg4idea.command.mq; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.action.HgCommandResultNotifier; import org.zmlx.hg4idea.execution.HgCommandExecutor; import org.zmlx.hg4idea.execution.HgCommandResult; -import org.zmlx.hg4idea.execution.HgCommandResultHandler; import org.zmlx.hg4idea.repo.HgRepository; import org.zmlx.hg4idea.util.HgErrorUtil; @@ -35,19 +33,15 @@ public class HgQDeleteCommand { myRepository = repository; } - public void execute(@NotNull final List patchNames) { + public void executeInCurrentThread(@NotNull final List patchNames) { final Project project = myRepository.getProject(); - new HgCommandExecutor(project) - .execute(myRepository.getRoot(), "qdelete", patchNames, new HgCommandResultHandler() { - @Override - public void process(@Nullable HgCommandResult result) { - if (HgErrorUtil.hasErrorsInCommandExecution(result)) { - new HgCommandResultNotifier(project) - .notifyError(result, "QDelete command failed", - "Could not delete selected " + StringUtil.pluralize("patch", patchNames.size())); - } - myRepository.update(); - } - }); + HgCommandResult result = new HgCommandExecutor(project) + .executeInCurrentThread(myRepository.getRoot(), "qdelete", patchNames); + if (HgErrorUtil.hasErrorsInCommandExecution(result)) { + new HgCommandResultNotifier(project) + .notifyError(result, "QDelete command failed", + "Could not delete selected " + StringUtil.pluralize("patch", patchNames.size())); + } + myRepository.update(); } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgMqUnAppliedPatchesPanel.java b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgMqUnAppliedPatchesPanel.java index 8448a87dabaf..0132efd4de9b 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgMqUnAppliedPatchesPanel.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/ui/HgMqUnAppliedPatchesPanel.java @@ -260,7 +260,7 @@ public class HgMqUnAppliedPatchesPanel extends JPanel implements DataProvider, H @Override public void run() { ProgressManager.getInstance().getProgressIndicator().setText("Deleting patches..."); - new HgQDeleteCommand(myRepository).execute(names); + new HgQDeleteCommand(myRepository).executeInCurrentThread(names); } }; updatePatchSeriesInBackground(deleteTask);