mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ds: drop non-intractiv consoles
GitOrigin-RevId: 21569629f8a81dc12ccc47f02ae354a4dfb10bf3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6d939d54c9
commit
ad81a4e009
@@ -289,7 +289,6 @@ python.console=Python Console
|
||||
python.console.history.root=Python Consoles
|
||||
python.console.run.anything.provider=Runs Python Console
|
||||
python.console.not.supported=Python console for {0} interpreter is not supported
|
||||
python.console.toolbar.action.available.non.interactive=The action is not available for non-interactive shell
|
||||
|
||||
runcfg.unittest.dlg.test_function_title=Function
|
||||
run.configuration.remote.debug.name=Python Remote Debug
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
package com.jetbrains.python.actions
|
||||
|
||||
import com.intellij.codeInsight.hint.HintManager
|
||||
import com.intellij.execution.target.value.TargetEnvironmentFunction
|
||||
import com.intellij.execution.ui.ExecutionConsole
|
||||
import com.intellij.execution.ui.RunContentDescriptor
|
||||
@@ -17,7 +16,6 @@ import com.intellij.openapi.wm.ToolWindowId
|
||||
import com.intellij.openapi.wm.ToolWindowManager
|
||||
import com.intellij.ui.content.ContentManager
|
||||
import com.intellij.xdebugger.XDebuggerManager
|
||||
import com.jetbrains.python.PyBundle
|
||||
import com.jetbrains.python.console.*
|
||||
import com.jetbrains.python.run.PythonRunConfiguration
|
||||
import java.util.function.Consumer
|
||||
@@ -80,7 +78,6 @@ private fun executeCodeInConsole(project: Project,
|
||||
var isDebug = false
|
||||
var newConsoleListener: PydevConsoleRunner.ConsoleListener? = null
|
||||
val virtualFile = (editor as? EditorImpl)?.virtualFile
|
||||
if (!checkIfAvailableAndShowHint(editor)) return
|
||||
if (canUseExistingConsole) {
|
||||
if (virtualFile != null && PyExecuteConsoleCustomizer.instance.isCustomDescriptorSupported(virtualFile)) {
|
||||
val (descriptor, listener) = getCustomDescriptor(project, virtualFile)
|
||||
@@ -114,16 +111,6 @@ private fun executeCodeInConsole(project: Project,
|
||||
}
|
||||
}
|
||||
|
||||
fun checkIfAvailableAndShowHint(editor: Editor?): Boolean {
|
||||
val virtualFile = (editor as? EditorImpl)?.virtualFile
|
||||
if (editor != null && virtualFile != null && PyExecuteConsoleCustomizer.instance.getCustomDescriptorType(virtualFile) ==
|
||||
DescriptorType.NON_INTERACTIVE) {
|
||||
HintManager.getInstance().showErrorHint(editor, PyBundle.message("python.console.toolbar.action.available.non.interactive"))
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun getCustomDescriptor(project: Project, virtualFile: VirtualFile): Pair<RunContentDescriptor?, PydevConsoleRunner.ConsoleListener?> {
|
||||
val executeCustomizer = PyExecuteConsoleCustomizer.instance
|
||||
when (executeCustomizer.getCustomDescriptorType(virtualFile)) {
|
||||
@@ -142,9 +129,6 @@ fun getCustomDescriptor(project: Project, virtualFile: VirtualFile): Pair<RunCon
|
||||
DescriptorType.STARTING -> {
|
||||
return Pair(null, null)
|
||||
}
|
||||
DescriptorType.NON_INTERACTIVE -> {
|
||||
throw IllegalStateException("This code shouldn't be called for a non-interactive descriptor")
|
||||
}
|
||||
else -> {
|
||||
throw IllegalStateException("Custom descriptor for ${virtualFile} is null")
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ public class PyExecuteSelectionAction extends DumbAwareAction {
|
||||
if (editor != null && project != null) {
|
||||
PythonRunConfiguration config = PyExecuteConsoleCustomizer.Companion.getInstance().getContextConfig(e.getDataContext());
|
||||
final String selectionText = getSelectionText(editor);
|
||||
if (!PyExecuteInConsole.checkIfAvailableAndShowHint(editor)) return;
|
||||
if (selectionText != null) {
|
||||
PyExecuteInConsole.executeCodeInConsole(project, selectionText, editor, true, true, false, config);
|
||||
}
|
||||
|
||||
@@ -77,5 +77,5 @@ interface PyExecuteConsoleCustomizer {
|
||||
}
|
||||
|
||||
enum class DescriptorType {
|
||||
NEW, EXISTING, STARTING, NON_INTERACTIVE
|
||||
NEW, EXISTING, STARTING
|
||||
}
|
||||
Reference in New Issue
Block a user