idea: cleanup 'public', property access syntax
This commit is contained in:
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.console.actions.logError
|
||||
|
||||
private val XML_PREAMBLE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||
|
||||
public class CommandExecutor(private val runner: KotlinConsoleRunner) {
|
||||
class CommandExecutor(private val runner: KotlinConsoleRunner) {
|
||||
private val commandHistory = runner.commandHistory
|
||||
private val historyUpdater = HistoryUpdater(runner)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.intellij.openapi.compiler.CompilerManager
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
|
||||
public class ConsoleCompilerHelper(
|
||||
class ConsoleCompilerHelper(
|
||||
private val project: Project,
|
||||
private val module: Module,
|
||||
private val executor: Executor,
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.intellij.openapi.util.TextRange
|
||||
import org.jetbrains.kotlin.console.gutter.ConsoleIndicatorRenderer
|
||||
import org.jetbrains.kotlin.console.gutter.ReplIcons
|
||||
|
||||
public class HistoryUpdater(private val runner: KotlinConsoleRunner) {
|
||||
class HistoryUpdater(private val runner: KotlinConsoleRunner) {
|
||||
private val consoleView: LanguageConsoleImpl by lazy { runner.consoleView as LanguageConsoleImpl }
|
||||
|
||||
fun printNewCommandInHistory(trimmedCommandText: String): TextRange {
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
private val REPL_TITLE = "Kotlin REPL"
|
||||
|
||||
public class KotlinConsoleKeeper(val project: Project) {
|
||||
class KotlinConsoleKeeper(val project: Project) {
|
||||
private val consoleMap: MutableMap<VirtualFile, KotlinConsoleRunner> = ConcurrentHashMap()
|
||||
|
||||
fun getConsoleByVirtualFile(virtualFile: VirtualFile) = consoleMap[virtualFile]
|
||||
|
||||
@@ -59,7 +59,7 @@ import kotlin.properties.Delegates
|
||||
|
||||
private val KOTLIN_SHELL_EXECUTE_ACTION_ID = "KotlinShellExecute"
|
||||
|
||||
public class KotlinConsoleRunner(
|
||||
class KotlinConsoleRunner(
|
||||
val module: Module,
|
||||
private val cmdLine: GeneralCommandLine,
|
||||
internal val previousCompilationFailed: Boolean,
|
||||
|
||||
@@ -23,22 +23,22 @@ import com.intellij.ui.Gray
|
||||
import com.intellij.ui.JBColor
|
||||
import java.awt.Font
|
||||
|
||||
public object ReplColors {
|
||||
public val HISTORY_GUTTER_COLOR: JBColor = JBColor(Gray.xF2, Gray.x41)
|
||||
public val EDITOR_GUTTER_COLOR: JBColor = JBColor(Gray.xCF, Gray.x31)
|
||||
public val PLACEHOLDER_COLOR: JBColor = JBColor.LIGHT_GRAY
|
||||
object ReplColors {
|
||||
val HISTORY_GUTTER_COLOR: JBColor = JBColor(Gray.xF2, Gray.x41)
|
||||
val EDITOR_GUTTER_COLOR: JBColor = JBColor(Gray.xCF, Gray.x31)
|
||||
val PLACEHOLDER_COLOR: JBColor = JBColor.LIGHT_GRAY
|
||||
|
||||
public val WARNING_INFO_CONTENT_TYPE: ConsoleViewContentType =
|
||||
val WARNING_INFO_CONTENT_TYPE: ConsoleViewContentType =
|
||||
ConsoleViewContentType(
|
||||
"KOTLIN_CONSOLE_WARNING_INFO",
|
||||
TextAttributes().apply { fontType = Font.ITALIC; foregroundColor = JBColor.RED }
|
||||
)
|
||||
public val INITIAL_PROMPT_CONTENT_TYPE: ConsoleViewContentType =
|
||||
val INITIAL_PROMPT_CONTENT_TYPE: ConsoleViewContentType =
|
||||
ConsoleViewContentType(
|
||||
"KOTLIN_CONSOLE_INITIAL_PROMPT",
|
||||
TextAttributes().apply { fontType = Font.BOLD }
|
||||
)
|
||||
public val USER_OUTPUT_CONTENT_TYPE: ConsoleViewContentType =
|
||||
val USER_OUTPUT_CONTENT_TYPE: ConsoleViewContentType =
|
||||
ConsoleViewContentType(
|
||||
"KOTLIN_CONSOLE_USER_OUTPUT",
|
||||
TextAttributes().apply { fontType = Font.ITALIC; foregroundColor = Colors.DARK_GREEN }
|
||||
|
||||
@@ -30,8 +30,8 @@ import javax.xml.parsers.DocumentBuilderFactory
|
||||
|
||||
private val XML_PREFIX = "<?xml"
|
||||
|
||||
public val XML_REPLACEMENTS: Array<String> = arrayOf("#n", "#diez")
|
||||
public val SOURCE_CHARS: Array<String> = arrayOf("\n", "#")
|
||||
val XML_REPLACEMENTS: Array<String> = arrayOf("#n", "#diez")
|
||||
val SOURCE_CHARS: Array<String> = arrayOf("\n", "#")
|
||||
|
||||
data class SeverityDetails(val severity: Severity, val description: String, val range: TextRange)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.console.gutter.ConsoleIndicatorRenderer
|
||||
import org.jetbrains.kotlin.console.gutter.ReplIcons
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
|
||||
public class ReplOutputProcessor(
|
||||
class ReplOutputProcessor(
|
||||
private val runner: KotlinConsoleRunner
|
||||
) {
|
||||
private val project = runner.project
|
||||
|
||||
@@ -24,10 +24,10 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory
|
||||
import org.jetbrains.kotlin.console.KotlinConsoleKeeper
|
||||
|
||||
public class ConsoleModuleDialog(private val project: Project) {
|
||||
class ConsoleModuleDialog(private val project: Project) {
|
||||
private val TITLE = "Choose context module..."
|
||||
|
||||
public fun showIfNeeded(dataContext: DataContext) {
|
||||
fun showIfNeeded(dataContext: DataContext) {
|
||||
val module = getModule(dataContext)
|
||||
if (module != null) return runConsole(module)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ fun errorNotification(project: Project?, message: String) {
|
||||
|
||||
fun logError(cl: Class<*>, message: String) = with(Logger.getInstance(cl)) { error(message) }
|
||||
|
||||
public class RunKotlinConsoleAction : AnAction() {
|
||||
class RunKotlinConsoleAction : AnAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project ?: return errorNotification(null, "Project not found")
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RunKotlinConsoleAction : AnAction() {
|
||||
}
|
||||
}
|
||||
|
||||
public class KtExecuteCommandAction(private val consoleFile: VirtualFile) : AnAction() {
|
||||
class KtExecuteCommandAction(private val consoleFile: VirtualFile) : AnAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project ?: return errorNotification(null, "Cannot find project")
|
||||
val ktConsole = KotlinConsoleKeeper.getInstance(project).getConsoleByVirtualFile(consoleFile) ?: return
|
||||
@@ -53,7 +53,7 @@ public class KtExecuteCommandAction(private val consoleFile: VirtualFile) : AnAc
|
||||
}
|
||||
}
|
||||
|
||||
public class BuildAndRestartConsoleAction(
|
||||
class BuildAndRestartConsoleAction(
|
||||
private val runner: KotlinConsoleRunner
|
||||
) : AnAction("Build and restart", "Build module '${runner.module.name}' and restart", AllIcons.Actions.Restart) {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.intellij.openapi.editor.markup.GutterIconRenderer
|
||||
import org.jetbrains.kotlin.console.SeverityDetails
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
|
||||
public class ConsoleErrorRenderer(private val messages: List<SeverityDetails>) : GutterIconRenderer() {
|
||||
class ConsoleErrorRenderer(private val messages: List<SeverityDetails>) : GutterIconRenderer() {
|
||||
private fun msgType(severity: Severity) = when (severity) {
|
||||
Severity.ERROR -> "Error:"
|
||||
Severity.WARNING -> "Warning:"
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.console.gutter
|
||||
import com.intellij.execution.console.BasicGutterContentProvider
|
||||
import com.intellij.openapi.editor.Editor
|
||||
|
||||
public class ConsoleGutterContentProvider : BasicGutterContentProvider() {
|
||||
class ConsoleGutterContentProvider : BasicGutterContentProvider() {
|
||||
/**
|
||||
* This method overriding is needed to prevent [BasicGutterContentProvider] from adding some strange unicode
|
||||
* symbols of zero width and to ease range highlighting.
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.console.gutter
|
||||
|
||||
import com.intellij.openapi.editor.markup.GutterIconRenderer
|
||||
|
||||
public class ConsoleIndicatorRenderer(iconWithTooltip: IconWithTooltip) : GutterIconRenderer() {
|
||||
class ConsoleIndicatorRenderer(iconWithTooltip: IconWithTooltip) : GutterIconRenderer() {
|
||||
private val icon = iconWithTooltip.icon
|
||||
private val tooltip = iconWithTooltip.tooltip
|
||||
|
||||
|
||||
@@ -20,19 +20,19 @@ import com.intellij.icons.AllIcons
|
||||
import org.jetbrains.kotlin.idea.KotlinIcons
|
||||
import javax.swing.Icon
|
||||
|
||||
public data class IconWithTooltip(val icon: Icon, val tooltip: String?)
|
||||
data class IconWithTooltip(val icon: Icon, val tooltip: String?)
|
||||
|
||||
public object ReplIcons {
|
||||
public val BUILD_WARNING_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.Ide.Warning_notifications, null)
|
||||
public val HISTORY_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.General.MessageHistory, "History of executed commands")
|
||||
public val EDITOR_INDICATOR: IconWithTooltip = IconWithTooltip(KotlinIcons.LAUNCH, "Write your commands here")
|
||||
public val EDITOR_READLINE_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.General.Balloon, "Waiting for input...")
|
||||
public val COMMAND_MARKER: IconWithTooltip = IconWithTooltip(AllIcons.General.Run, "Executed command")
|
||||
public val READLINE_MARKER: IconWithTooltip = IconWithTooltip(AllIcons.Icons.Ide.SpeedSearchPrompt, "Input line")
|
||||
object ReplIcons {
|
||||
val BUILD_WARNING_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.Ide.Warning_notifications, null)
|
||||
val HISTORY_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.General.MessageHistory, "History of executed commands")
|
||||
val EDITOR_INDICATOR: IconWithTooltip = IconWithTooltip(KotlinIcons.LAUNCH, "Write your commands here")
|
||||
val EDITOR_READLINE_INDICATOR: IconWithTooltip = IconWithTooltip(AllIcons.General.Balloon, "Waiting for input...")
|
||||
val COMMAND_MARKER: IconWithTooltip = IconWithTooltip(AllIcons.General.Run, "Executed command")
|
||||
val READLINE_MARKER: IconWithTooltip = IconWithTooltip(AllIcons.Icons.Ide.SpeedSearchPrompt, "Input line")
|
||||
|
||||
// command result icons
|
||||
public val SYSTEM_HELP: IconWithTooltip = IconWithTooltip(AllIcons.Actions.Menu_help, "System help")
|
||||
public val RESULT: IconWithTooltip = IconWithTooltip(AllIcons.Vcs.Equal, "Result")
|
||||
public val COMPILER_ERROR: Icon = AllIcons.General.Error
|
||||
public val RUNTIME_EXCEPTION: IconWithTooltip = IconWithTooltip(AllIcons.General.BalloonWarning, "Runtime exception")
|
||||
val SYSTEM_HELP: IconWithTooltip = IconWithTooltip(AllIcons.Actions.Menu_help, "System help")
|
||||
val RESULT: IconWithTooltip = IconWithTooltip(AllIcons.Vcs.Equal, "Result")
|
||||
val COMPILER_ERROR: Icon = AllIcons.General.Error
|
||||
val RUNTIME_EXCEPTION: IconWithTooltip = IconWithTooltip(AllIcons.General.BalloonWarning, "Runtime exception")
|
||||
}
|
||||
Reference in New Issue
Block a user