Minor: rename file and rearrange classes
This commit is contained in:
+22
-22
@@ -30,28 +30,6 @@ import com.intellij.openapi.wm.ToolWindowManager
|
|||||||
import org.jetbrains.kotlin.idea.scratch.ScratchExpression
|
import org.jetbrains.kotlin.idea.scratch.ScratchExpression
|
||||||
import org.jetbrains.kotlin.idea.scratch.ScratchFile
|
import org.jetbrains.kotlin.idea.scratch.ScratchFile
|
||||||
|
|
||||||
class ScratchToolWindowFactory : ToolWindowFactory {
|
|
||||||
companion object {
|
|
||||||
val ID = "Scratch Output"
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
|
|
||||||
val consoleView = ConsoleViewImpl(project, true)
|
|
||||||
toolWindow.isToHideOnEmptyContent = true
|
|
||||||
toolWindow.icon = ScratchFileType.INSTANCE.icon
|
|
||||||
|
|
||||||
val contentManager = toolWindow.contentManager
|
|
||||||
val content = contentManager.factory.createContent(consoleView.component, null, false)
|
|
||||||
contentManager.addContent(content)
|
|
||||||
val editor = consoleView.editor
|
|
||||||
if (editor is EditorEx) {
|
|
||||||
editor.isRendererMode = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Disposer.register(project, consoleView)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
object ToolWindowScratchOutputHandler : ScratchOutputHandlerAdapter() {
|
object ToolWindowScratchOutputHandler : ScratchOutputHandlerAdapter() {
|
||||||
|
|
||||||
override fun handle(file: ScratchFile, expression: ScratchExpression, output: ScratchOutput) {
|
override fun handle(file: ScratchFile, expression: ScratchExpression, output: ScratchOutput) {
|
||||||
@@ -120,3 +98,25 @@ object ToolWindowScratchOutputHandler : ScratchOutputHandlerAdapter() {
|
|||||||
return window
|
return window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ScratchToolWindowFactory : ToolWindowFactory {
|
||||||
|
companion object {
|
||||||
|
const val ID = "Scratch Output"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
|
||||||
|
val consoleView = ConsoleViewImpl(project, true)
|
||||||
|
toolWindow.isToHideOnEmptyContent = true
|
||||||
|
toolWindow.icon = ScratchFileType.INSTANCE.icon
|
||||||
|
|
||||||
|
val contentManager = toolWindow.contentManager
|
||||||
|
val content = contentManager.factory.createContent(consoleView.component, null, false)
|
||||||
|
contentManager.addContent(content)
|
||||||
|
val editor = consoleView.editor
|
||||||
|
if (editor is EditorEx) {
|
||||||
|
editor.isRendererMode = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Disposer.register(project, consoleView)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user