mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[hg] rename Mq patches commands execute to executeInCurrentThread and move real execution from PooledThread to current
This commit is contained in:
@@ -35,7 +35,7 @@ public abstract class HgActionFromMqPatches extends DumbAwareAction {
|
||||
@Override
|
||||
public void run() {
|
||||
ProgressManager.getInstance().getProgressIndicator().setText(getTitle());
|
||||
execute(repository, names);
|
||||
executeInCurrentThread(repository, names);
|
||||
}
|
||||
};
|
||||
patchInfo.updatePatchSeriesInBackground(task);
|
||||
@@ -51,7 +51,7 @@ public abstract class HgActionFromMqPatches extends DumbAwareAction {
|
||||
return true; //todo should be improved, param not needed
|
||||
}
|
||||
|
||||
protected abstract void execute(@NotNull HgRepository repository, @NotNull List<String> patchNames);
|
||||
protected abstract void executeInCurrentThread(@NotNull HgRepository repository, @NotNull List<String> patchNames);
|
||||
|
||||
@NotNull
|
||||
protected abstract String getTitle();
|
||||
|
||||
@@ -24,8 +24,8 @@ import java.util.List;
|
||||
public class HgQFoldActionFromPatches extends HgActionFromMqPatches {
|
||||
|
||||
@Override
|
||||
protected void execute(@NotNull HgRepository repository, @NotNull List<String> patchNames) {
|
||||
new HgQFoldCommand(repository).execute(patchNames);
|
||||
protected void executeInCurrentThread(@NotNull HgRepository repository, @NotNull List<String> patchNames) {
|
||||
new HgQFoldCommand(repository).executeInCurrentThread(patchNames);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.zmlx.hg4idea.repo.HgRepository;
|
||||
public class HgQGotoActionFromMqPatches extends HgSingleActionFomMqPatches {
|
||||
|
||||
@Override
|
||||
protected void execute(@NotNull HgRepository repository, @NotNull String patchName) {
|
||||
protected void executeInCurrentThread(@NotNull HgRepository repository, @NotNull String patchName) {
|
||||
new HgQGotoCommand(repository).executeInCurrentThread(patchName);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ import org.zmlx.hg4idea.repo.HgRepository;
|
||||
|
||||
public class HgQPushActionFromPatches extends HgSingleActionFomMqPatches {
|
||||
@Override
|
||||
protected void execute(@NotNull HgRepository repository, @NotNull String patchName) {
|
||||
new HgQPushCommand(repository).execute(patchName);
|
||||
protected void executeInCurrentThread(@NotNull HgRepository repository, @NotNull String patchName) {
|
||||
new HgQPushCommand(repository).executeInCurrentThread(patchName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -24,9 +24,9 @@ import java.util.List;
|
||||
|
||||
public abstract class HgSingleActionFomMqPatches extends HgActionFromMqPatches {
|
||||
@Override
|
||||
protected void execute(@NotNull HgRepository repository, @NotNull List<String> patchNames) {
|
||||
protected void executeInCurrentThread(@NotNull HgRepository repository, @NotNull List<String> patchNames) {
|
||||
assert patchNames.size() == 1;
|
||||
execute(repository, patchNames.iterator().next());
|
||||
executeInCurrentThread(repository, patchNames.iterator().next());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,5 +35,5 @@ public abstract class HgSingleActionFomMqPatches extends HgActionFromMqPatches {
|
||||
e.getPresentation().setEnabled(patchInfo != null && patchInfo.getSelectedRowsCount() == 1);
|
||||
}
|
||||
|
||||
protected abstract void execute(@NotNull HgRepository repository, @NotNull String patchName);
|
||||
protected abstract void executeInCurrentThread(@NotNull HgRepository repository, @NotNull String patchName);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,9 @@ package org.zmlx.hg4idea.command.mq;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
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;
|
||||
|
||||
@@ -34,18 +32,14 @@ public class HgQFoldCommand {
|
||||
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(), "qfold", patchNames, new HgCommandResultHandler() {
|
||||
@Override
|
||||
public void process(@Nullable HgCommandResult result) {
|
||||
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
|
||||
new HgCommandResultNotifier(project)
|
||||
.notifyError(result, "QFold command failed", "Could not fold patches into the current patch");
|
||||
}
|
||||
myRepository.update();
|
||||
}
|
||||
});
|
||||
HgCommandResult result = new HgCommandExecutor(project)
|
||||
.executeInCurrentThread(myRepository.getRoot(), "qfold", patchNames);
|
||||
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
|
||||
new HgCommandResultNotifier(project)
|
||||
.notifyError(result, "QFold command failed", "Could not fold patches into the current patch");
|
||||
}
|
||||
myRepository.update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,11 +17,9 @@ package org.zmlx.hg4idea.command.mq;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
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;
|
||||
|
||||
@@ -34,18 +32,14 @@ public class HgQPushCommand {
|
||||
myRepository = repository;
|
||||
}
|
||||
|
||||
public void execute(@NotNull final String patchName) {
|
||||
public void executeInCurrentThread(@NotNull final String patchName) {
|
||||
final Project project = myRepository.getProject();
|
||||
new HgCommandExecutor(project)
|
||||
.execute(myRepository.getRoot(), "qpush", Arrays.asList("--move", patchName), new HgCommandResultHandler() {
|
||||
@Override
|
||||
public void process(@Nullable HgCommandResult result) {
|
||||
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
|
||||
new HgCommandResultNotifier(project)
|
||||
.notifyError(result, "QPush command failed", "Could not apply selected patch " + patchName);
|
||||
}
|
||||
myRepository.update();
|
||||
}
|
||||
});
|
||||
HgCommandResult result =
|
||||
new HgCommandExecutor(project).executeInCurrentThread(myRepository.getRoot(), "qpush", Arrays.asList("--move", patchName));
|
||||
if (HgErrorUtil.hasErrorsInCommandExecution(result)) {
|
||||
new HgCommandResultNotifier(project)
|
||||
.notifyError(result, "QPush command failed", "Could not apply selected patch " + patchName);
|
||||
}
|
||||
myRepository.update();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user