[tests] disable pattern configuration suggestions for editor without selection

GitOrigin-RevId: 02729308d38ba7777211cd12cc4fd6e8e7a3baaf
This commit is contained in:
Anna Kozlova
2022-01-12 15:18:41 +00:00
committed by intellij-monorepo-bot
parent 8cbf9a517f
commit c7cc9ba2cb
@@ -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;
}