diff: hide 'Prev/Next difference' actions if not available
authorAleksey Pivovarov <AMPivovarov@gmail.com>
Thu, 26 Feb 2015 10:21:27 +0000 (13:21 +0300)
committerAleksey Pivovarov <AMPivovarov@gmail.com>
Thu, 26 Feb 2015 12:22:05 +0000 (15:22 +0300)
platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java

index a8d07656c78c60f8f619e2359cbc8bd1c565b207..ac9210e3059801cf4b828a066bf440c11d031cf1 100644 (file)
@@ -606,6 +606,12 @@ public abstract class DiffRequestProcessor implements Disposable {
       }
 
       PrevNextDifferenceIterable iterable = DiffDataKeys.PREV_NEXT_DIFFERENCE_ITERABLE.getData(e.getDataContext());
+      if (iterable == null && !isNavigationEnabled()) {
+        e.getPresentation().setEnabledAndVisible(false);
+        return;
+      }
+
+      e.getPresentation().setVisible(true);
       if (iterable != null && iterable.canGoNext()) {
         e.getPresentation().setEnabled(true);
         return;
@@ -650,6 +656,12 @@ public abstract class DiffRequestProcessor implements Disposable {
       }
 
       PrevNextDifferenceIterable iterable = DiffDataKeys.PREV_NEXT_DIFFERENCE_ITERABLE.getData(e.getDataContext());
+      if (iterable == null && !isNavigationEnabled()) {
+        e.getPresentation().setEnabledAndVisible(false);
+        return;
+      }
+
+      e.getPresentation().setVisible(true);
       if (iterable != null && iterable.canGoPrev()) {
         e.getPresentation().setEnabled(true);
         return;