[hg] execute mq delete in current thread

This commit is contained in:
Nadya Zabrodina
2016-03-09 14:29:19 +03:00
parent 6322d5c36d
commit f3b7c57bd0
2 changed files with 10 additions and 16 deletions
@@ -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<String> patchNames) {
public void executeInCurrentThread(@NotNull final List<String> 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();
}
}
@@ -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);