mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: cleanup - move PerformInBackgroundOption to VcsConfiguration
This commit is contained in:
@@ -138,6 +138,7 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
|
||||
private final PerformInBackgroundOption myEditOption = new EditInBackgroundOption();
|
||||
private final PerformInBackgroundOption myCheckoutOption = new CheckoutInBackgroundOption();
|
||||
private final PerformInBackgroundOption myAddRemoveOption = new AddRemoveInBackgroundOption();
|
||||
private final PerformInBackgroundOption myRollbackOption = new RollbackInBackgroundOption();
|
||||
|
||||
@Override
|
||||
public VcsConfiguration getState() {
|
||||
@@ -202,6 +203,10 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
|
||||
return myAddRemoveOption;
|
||||
}
|
||||
|
||||
public PerformInBackgroundOption getRollbackOption() {
|
||||
return myRollbackOption;
|
||||
}
|
||||
|
||||
private class UpdateInBackgroundOption implements PerformInBackgroundOption {
|
||||
@Override
|
||||
public boolean shouldStartInBackground() {
|
||||
@@ -226,7 +231,6 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
|
||||
public void processSentToBackground() {
|
||||
PERFORM_EDIT_IN_BACKGROUND = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class CheckoutInBackgroundOption implements PerformInBackgroundOption {
|
||||
@@ -239,7 +243,6 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
|
||||
public void processSentToBackground() {
|
||||
PERFORM_CHECKOUT_IN_BACKGROUND = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class AddRemoveInBackgroundOption implements PerformInBackgroundOption {
|
||||
@@ -252,7 +255,18 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
|
||||
public void processSentToBackground() {
|
||||
PERFORM_ADD_REMOVE_IN_BACKGROUND = true;
|
||||
}
|
||||
}
|
||||
|
||||
private class RollbackInBackgroundOption implements PerformInBackgroundOption {
|
||||
@Override
|
||||
public boolean shouldStartInBackground() {
|
||||
return PERFORM_ROLLBACK_IN_BACKGROUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSentToBackground() {
|
||||
PERFORM_ROLLBACK_IN_BACKGROUND = true;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPatchFileExtension() {
|
||||
|
||||
@@ -19,7 +19,10 @@ import com.intellij.history.LocalHistory;
|
||||
import com.intellij.history.LocalHistoryAction;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -77,7 +80,7 @@ public class RollbackWorker {
|
||||
boolean rollbackRangesExcludedFromCommit,
|
||||
@Nullable Runnable afterVcsRefreshInAwt,
|
||||
@Nullable String localHistoryActionName) {
|
||||
ProgressManager.getInstance().executeNonCancelableSection(()->{
|
||||
ProgressManager.getInstance().executeNonCancelableSection(() -> {
|
||||
ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(myProject);
|
||||
Collection<LocalChangeList> affectedChangelists = changeListManager.getAffectedLists(changes);
|
||||
|
||||
@@ -111,29 +114,19 @@ public class RollbackWorker {
|
||||
|
||||
if (ApplicationManager.getApplication().isDispatchThread() && !myInvokedFromModalContext) {
|
||||
ProgressManager.getInstance().run(new Task.Backgroundable(myProject, myOperationName, false,
|
||||
new PerformInBackgroundOption() {
|
||||
@Override
|
||||
public boolean shouldStartInBackground() {
|
||||
return VcsConfiguration.getInstance(myProject).PERFORM_ROLLBACK_IN_BACKGROUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSentToBackground() {
|
||||
VcsConfiguration.getInstance(myProject).PERFORM_ROLLBACK_IN_BACKGROUND = true;
|
||||
}
|
||||
}) {
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
rollbackAction.run();
|
||||
}
|
||||
});
|
||||
VcsConfiguration.getInstance(myProject).getRollbackOption()) {
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
rollbackAction.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (myInvokedFromModalContext) {
|
||||
ProgressManager.getInstance().run(new Task.Modal(myProject, myOperationName, false) {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
rollbackAction.run();
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
rollbackAction.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
rollbackAction.run();
|
||||
|
||||
Reference in New Issue
Block a user