From a7928cd69a7f2b264f36dd8aa4322544ca8ffee1 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Tue, 22 Sep 2015 13:17:20 +0300 Subject: [PATCH] diff: testFramework: fix default selected index --- .../testframework/actions/ViewAssertEqualsDiffAction.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/testRunner/src/com/intellij/execution/testframework/actions/ViewAssertEqualsDiffAction.java b/platform/testRunner/src/com/intellij/execution/testframework/actions/ViewAssertEqualsDiffAction.java index 3b896e4e5d63..8fa4a2a1df7f 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/actions/ViewAssertEqualsDiffAction.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/actions/ViewAssertEqualsDiffAction.java @@ -55,11 +55,9 @@ public class ViewAssertEqualsDiffAction extends AnAction implements TestTreeView DiffHyperlink diffViewerProvider = testProxy.getDiffViewerProvider(); if (diffViewerProvider != null) { final List providers = collectAvailableProviders(TestTreeView.MODEL_DATA_KEY.getData(context)); - int index = Math.max(0, providers.indexOf(diffViewerProvider)); - if (currentHyperlink != null) { - index = Math.max(index, providers.indexOf(currentHyperlink)); - } - new MyDiffWindow(project, providers, index).show(); + int index = currentHyperlink != null ? providers.indexOf(currentHyperlink) : -1; + if (index == -1) index = providers.indexOf(diffViewerProvider); + new MyDiffWindow(project, providers, Math.max(0, index)).show(); return true; } }