diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java index 1baee04dc65d..c73bf83b95f0 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java @@ -1,12 +1,14 @@ -// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.testframework; import com.intellij.execution.ExecutionBundle; import com.intellij.execution.Location; import com.intellij.notification.NotificationGroup; import com.intellij.notification.NotificationGroupManager; +import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.PlatformCoreDataKeys; +import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; @@ -49,6 +51,11 @@ public final class TestsUIUtil { return true; } } + return false; + } + Editor editor = CommonDataKeys.EDITOR.getData(dataContext); + if (editor != null && !editor.getSelectionModel().hasSelection() && editor.getCaretModel().getCaretCount() < 2) { + return true; } return false; }