mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: cleanup
This commit is contained in:
@@ -23,8 +23,6 @@ import com.intellij.diff.requests.DiffRequest;
|
||||
import com.intellij.diff.requests.SimpleDiffRequest;
|
||||
import com.intellij.diff.tools.binary.ThreesideBinaryDiffViewer;
|
||||
import com.intellij.diff.tools.holders.BinaryEditorHolder;
|
||||
import com.intellij.openapi.diff.DiffBundle;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.BooleanGetter;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -116,9 +114,7 @@ public class BinaryMergeTool implements MergeTool {
|
||||
components.closeHandler = new BooleanGetter() {
|
||||
@Override
|
||||
public boolean get() {
|
||||
return Messages.showYesNoDialog(getComponent().getRootPane(),
|
||||
DiffBundle.message("merge.dialog.exit.without.applying.changes.confirmation.message"),
|
||||
DiffBundle.message("cancel.visual.merge.dialog.title"), Messages.getQuestionIcon()) == Messages.YES;
|
||||
return MergeUtil.showExitWithoutApplyingChangesDialog(getComponent(), myMergeRequest, myMergeContext);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -134,14 +130,10 @@ public class BinaryMergeTool implements MergeTool {
|
||||
return new AbstractAction(caption) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (result == MergeResult.CANCEL) {
|
||||
if (Messages.showYesNoDialog(getComponent().getRootPane(),
|
||||
DiffBundle.message("merge.dialog.exit.without.applying.changes.confirmation.message"),
|
||||
DiffBundle.message("cancel.visual.merge.dialog.title"), Messages.getQuestionIcon()) != Messages.YES) {
|
||||
return;
|
||||
}
|
||||
if (result == MergeResult.CANCEL &&
|
||||
!MergeUtil.showExitWithoutApplyingChangesDialog(getComponent(), myMergeRequest, myMergeContext)) {
|
||||
return;
|
||||
}
|
||||
|
||||
myMergeContext.finishMerge(result);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,13 +17,16 @@ package com.intellij.diff.merge;
|
||||
|
||||
import com.intellij.diff.DiffContext;
|
||||
import com.intellij.diff.util.ThreeSide;
|
||||
import com.intellij.openapi.diff.DiffBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
|
||||
public class MergeUtil {
|
||||
@@ -90,4 +93,11 @@ public class MergeUtil {
|
||||
myMergeContext.putUserData(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean showExitWithoutApplyingChangesDialog(@NotNull JComponent component, @NotNull MergeRequest request, @NotNull MergeContext context) {
|
||||
return Messages.showYesNoDialog(component.getRootPane(),
|
||||
DiffBundle.message("merge.dialog.exit.without.applying.changes.confirmation.message"),
|
||||
DiffBundle.message("cancel.visual.merge.dialog.title"), Messages.getQuestionIcon()) ==
|
||||
Messages.YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,9 +166,7 @@ public class TextMergeTool implements MergeTool {
|
||||
components.closeHandler = new BooleanGetter() {
|
||||
@Override
|
||||
public boolean get() {
|
||||
return Messages.showYesNoDialog(getComponent().getRootPane(),
|
||||
DiffBundle.message("merge.dialog.exit.without.applying.changes.confirmation.message"),
|
||||
DiffBundle.message("cancel.visual.merge.dialog.title"), Messages.getQuestionIcon()) == Messages.YES;
|
||||
return MergeUtil.showExitWithoutApplyingChangesDialog(getComponent(), myMergeRequest, myMergeContext);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -313,12 +311,9 @@ public class TextMergeTool implements MergeTool {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (result == MergeResult.CANCEL) {
|
||||
if (Messages.showYesNoDialog(myPanel.getRootPane(),
|
||||
DiffBundle.message("merge.dialog.exit.without.applying.changes.confirmation.message"),
|
||||
DiffBundle.message("cancel.visual.merge.dialog.title"), Messages.getQuestionIcon()) != Messages.YES) {
|
||||
return;
|
||||
}
|
||||
if (result == MergeResult.CANCEL &&
|
||||
!MergeUtil.showExitWithoutApplyingChangesDialog(getComponent(), myMergeRequest, myMergeContext)) {
|
||||
return;
|
||||
}
|
||||
destroyChangedBlocks();
|
||||
myMergeContext.finishMerge(result);
|
||||
|
||||
+4
-13
@@ -25,11 +25,9 @@ import com.intellij.diff.util.DiffUtil;
|
||||
import com.intellij.openapi.command.undo.DocumentReference;
|
||||
import com.intellij.openapi.command.undo.DocumentReferenceManager;
|
||||
import com.intellij.openapi.command.undo.UndoManager;
|
||||
import com.intellij.openapi.diff.DiffBundle;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.BooleanGetter;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -115,10 +113,7 @@ public class ApplyPatchMergeTool implements MergeTool {
|
||||
components.closeHandler = new BooleanGetter() {
|
||||
@Override
|
||||
public boolean get() {
|
||||
return Messages.showYesNoDialog(getComponent().getRootPane(),
|
||||
DiffBundle.message("merge.dialog.exit.without.applying.changes.confirmation.message"),
|
||||
DiffBundle.message("cancel.visual.merge.dialog.title"), Messages.getQuestionIcon()) ==
|
||||
Messages.YES;
|
||||
return MergeUtil.showExitWithoutApplyingChangesDialog(getComponent(), myMergeRequest, myMergeContext);
|
||||
}
|
||||
};
|
||||
return components;
|
||||
@@ -133,13 +128,9 @@ public class ApplyPatchMergeTool implements MergeTool {
|
||||
return new AbstractAction(caption) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (result == MergeResult.CANCEL) {
|
||||
if (Messages.showYesNoDialog(getComponent().getRootPane(),
|
||||
DiffBundle.message("merge.dialog.exit.without.applying.changes.confirmation.message"),
|
||||
DiffBundle.message("cancel.visual.merge.dialog.title"), Messages.getQuestionIcon()) !=
|
||||
Messages.YES) {
|
||||
return;
|
||||
}
|
||||
if (result == MergeResult.CANCEL &&
|
||||
!MergeUtil.showExitWithoutApplyingChangesDialog(getComponent(), myMergeRequest, myMergeContext)) {
|
||||
return;
|
||||
}
|
||||
myMergeContext.finishMerge(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user