diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/MirrorToLeftAction.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/MirrorToLeftAction.java
new file mode 100644
index 000000000000..2ea2b7931a87
--- /dev/null
+++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/MirrorToLeftAction.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2017 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.diff.impl.dir.actions.popup;
+
+import com.intellij.ide.diff.DirDiffElement;
+import com.intellij.ide.diff.DirDiffOperation;
+import com.intellij.openapi.diff.impl.dir.DirDiffElementImpl;
+import org.jetbrains.annotations.NotNull;
+
+public class MirrorToLeftAction extends SetOperationToBase {
+ @Override
+ protected boolean isEnabledFor(DirDiffElement element) {
+ return true;
+ }
+
+ @NotNull
+ @Override
+ protected DirDiffOperation getOperation(DirDiffElementImpl element) {
+ if (element.isSource()) {
+ return DirDiffOperation.DELETE;
+ }
+ else {
+ return DirDiffOperation.COPY_FROM;
+ }
+ }
+}
diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/MirrorToRightAction.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/MirrorToRightAction.java
new file mode 100644
index 000000000000..7d42c34d2699
--- /dev/null
+++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/MirrorToRightAction.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2017 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.openapi.diff.impl.dir.actions.popup;
+
+import com.intellij.ide.diff.DirDiffElement;
+import com.intellij.ide.diff.DirDiffOperation;
+import com.intellij.openapi.diff.impl.dir.DirDiffElementImpl;
+import org.jetbrains.annotations.NotNull;
+
+public class MirrorToRightAction extends SetOperationToBase {
+ @Override
+ protected boolean isEnabledFor(DirDiffElement element) {
+ return true;
+ }
+
+ @NotNull
+ @Override
+ protected DirDiffOperation getOperation(DirDiffElementImpl element) {
+ if (element.isTarget()) {
+ return DirDiffOperation.DELETE;
+ }
+ else {
+ return DirDiffOperation.COPY_TO;
+ }
+ }
+}
diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetCopyToLeft.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetCopyToLeft.java
index 0c481d91be3c..a67976cd71d4 100644
--- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetCopyToLeft.java
+++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetCopyToLeft.java
@@ -17,6 +17,7 @@ package com.intellij.openapi.diff.impl.dir.actions.popup;
import com.intellij.ide.diff.DirDiffElement;
import com.intellij.ide.diff.DirDiffOperation;
+import com.intellij.openapi.diff.impl.dir.DirDiffElementImpl;
import org.jetbrains.annotations.NotNull;
/**
@@ -25,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
public class SetCopyToLeft extends SetOperationToBase {
@NotNull
@Override
- protected DirDiffOperation getOperation() {
+ protected DirDiffOperation getOperation(DirDiffElementImpl element) {
return DirDiffOperation.COPY_FROM;
}
diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetCopyToRight.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetCopyToRight.java
index f29d5f104204..2c011c161f0d 100644
--- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetCopyToRight.java
+++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetCopyToRight.java
@@ -17,6 +17,7 @@ package com.intellij.openapi.diff.impl.dir.actions.popup;
import com.intellij.ide.diff.DirDiffElement;
import com.intellij.ide.diff.DirDiffOperation;
+import com.intellij.openapi.diff.impl.dir.DirDiffElementImpl;
import org.jetbrains.annotations.NotNull;
/**
@@ -25,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
public class SetCopyToRight extends SetOperationToBase {
@NotNull
@Override
- protected DirDiffOperation getOperation() {
+ protected DirDiffOperation getOperation(DirDiffElementImpl element) {
return DirDiffOperation.COPY_TO;
}
diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetDefault.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetDefault.java
index 3afd8afb465f..9c0bfba7c943 100644
--- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetDefault.java
+++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetDefault.java
@@ -17,6 +17,7 @@ package com.intellij.openapi.diff.impl.dir.actions.popup;
import com.intellij.ide.diff.DirDiffElement;
import com.intellij.ide.diff.DirDiffOperation;
+import com.intellij.openapi.diff.impl.dir.DirDiffElementImpl;
import org.jetbrains.annotations.NotNull;
/**
@@ -25,8 +26,8 @@ import org.jetbrains.annotations.NotNull;
public class SetDefault extends SetOperationToBase {
@NotNull
@Override
- protected DirDiffOperation getOperation() {
- return DirDiffOperation.NONE;
+ protected DirDiffOperation getOperation(DirDiffElementImpl element) {
+ return element.getDefaultOperation();
}
@Override
diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetDelete.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetDelete.java
index ca0eadcd8753..ec7479d9a50d 100644
--- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetDelete.java
+++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetDelete.java
@@ -17,6 +17,7 @@ package com.intellij.openapi.diff.impl.dir.actions.popup;
import com.intellij.ide.diff.DirDiffElement;
import com.intellij.ide.diff.DirDiffOperation;
+import com.intellij.openapi.diff.impl.dir.DirDiffElementImpl;
import org.jetbrains.annotations.NotNull;
/**
@@ -25,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
public class SetDelete extends SetOperationToBase {
@NotNull
@Override
- protected DirDiffOperation getOperation() {
+ protected DirDiffOperation getOperation(DirDiffElementImpl element) {
return DirDiffOperation.DELETE;
}
diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetOperationToBase.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetOperationToBase.java
index 747f5252b736..13afa5241f60 100644
--- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetOperationToBase.java
+++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/popup/SetOperationToBase.java
@@ -33,14 +33,12 @@ import javax.swing.*;
public abstract class SetOperationToBase extends DumbAwareAction {
@Override
public void actionPerformed(AnActionEvent e) {
- DirDiffOperation operation = getOperation();
- boolean setToDefault = operation == DirDiffOperation.NONE;
final DirDiffTableModel model = getModel(e);
final JTable table = getTable(e);
assert model != null && table != null;
for (DirDiffElementImpl element : model.getSelectedElements()) {
if (isEnabledFor(element)) {
- element.setOperation(setToDefault ? element.getDefaultOperation() : operation);
+ element.setOperation(getOperation(element));
} else {
element.setOperation(DirDiffOperation.NONE);
}
@@ -49,7 +47,7 @@ public abstract class SetOperationToBase extends DumbAwareAction {
}
@NotNull
- protected abstract DirDiffOperation getOperation();
+ protected abstract DirDiffOperation getOperation(DirDiffElementImpl element);
@Override
public final void update(AnActionEvent e) {
diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml
index 715ae74e80b3..9362b552bc99 100644
--- a/platform/platform-resources/src/idea/PlatformActions.xml
+++ b/platform/platform-resources/src/idea/PlatformActions.xml
@@ -801,6 +801,9 @@
+
+
+