mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gui-tests] Greenify
This commit is contained in:
-1
@@ -37,7 +37,6 @@ object GlobalActionRecorder {
|
||||
private val LOG = Logger.getInstance("#${GlobalActionRecorder::class.qualifiedName}")
|
||||
|
||||
var isActive = false
|
||||
get
|
||||
private set
|
||||
|
||||
private val globalActionListener = object : AnActionListener {
|
||||
|
||||
@@ -22,7 +22,6 @@ object Writer {
|
||||
|
||||
private val scriptBuffer = StringBuilder()
|
||||
val indent = 2
|
||||
val withIndent = true
|
||||
|
||||
fun getScript(): String {
|
||||
return scriptBuffer.toString()
|
||||
@@ -32,7 +31,7 @@ object Writer {
|
||||
scriptBuffer.setLength(0)
|
||||
}
|
||||
|
||||
fun writeln(str: String) {
|
||||
private fun writeln(str: String) {
|
||||
write(str + "\n")
|
||||
}
|
||||
|
||||
@@ -45,16 +44,12 @@ object Writer {
|
||||
}
|
||||
|
||||
private fun writeToEditor(str: String) {
|
||||
val editor = GuiRecorderComponent.getEditor()
|
||||
val document = editor.document
|
||||
val document = GuiRecorderComponent.getEditor().document
|
||||
WriteCommandAction.runWriteCommandAction(null, { document.insertString(document.textLength, str) })
|
||||
}
|
||||
|
||||
fun writeWithIndent(code: String){
|
||||
var indentedString = ""
|
||||
if (withIndent) {
|
||||
indentedString = (0..(indent * ContextChecker.getContextDepth() - 1)).map { i -> ' ' }.joinToString(separator = "")
|
||||
}
|
||||
val indentedString = (0..(indent * ContextChecker.getContextDepth() - 1)).map { ' ' }.joinToString(separator = "")
|
||||
Writer.writeln("$indentedString$code")
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -18,12 +18,11 @@ package com.intellij.testGuiFramework.recorder.actions
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.testGuiFramework.recorder.components.GuiRecorderComponent
|
||||
import com.intellij.testGuiFramework.recorder.ui.GuiScriptEditorFrame
|
||||
|
||||
/**
|
||||
* @author Sergey Karashevich
|
||||
*/
|
||||
class ShowGuiEditorWindowAction() : AnAction() {
|
||||
class ShowGuiEditorWindowAction : AnAction() {
|
||||
|
||||
override fun actionPerformed(p0: AnActionEvent?) {
|
||||
val frame = GuiRecorderComponent.frame
|
||||
|
||||
+1
-2
@@ -31,14 +31,13 @@ class StartPauseRecAction : ToggleAction(null, "Start/Stop GUI Script Recording"
|
||||
override fun isSelected(actionEvent: AnActionEvent?): Boolean = GlobalActionRecorder.isActive
|
||||
|
||||
override fun setSelected(actionEvent: AnActionEvent?, toStart: Boolean) {
|
||||
val presentation = actionEvent?.presentation ?: templatePresentation
|
||||
if (toStart) {
|
||||
val presentation = if (actionEvent != null) actionEvent.presentation else templatePresentation
|
||||
presentation.description = "Stop GUI Script Recording"
|
||||
Notifier.updateStatus("Recording started")
|
||||
GlobalActionRecorder.activate()
|
||||
}
|
||||
else {
|
||||
val presentation = if (actionEvent != null) actionEvent.presentation else templatePresentation
|
||||
presentation.description = "Start GUI Script Recording"
|
||||
Notifier.updateStatus("Recording paused")
|
||||
GlobalActionRecorder.deactivate()
|
||||
|
||||
+1
-4
@@ -15,10 +15,7 @@ class UpdateEditorAction : AnAction(null, "Update GUI Script Editor (get recorde
|
||||
|
||||
override fun actionPerformed(actionEvent: AnActionEvent?) {
|
||||
val editor = GuiRecorderComponent.getEditor()
|
||||
ApplicationManager.getApplication().runWriteAction { editor.document.setText(getGuiScriptBuffer()) }
|
||||
ApplicationManager.getApplication().runWriteAction { editor.document.setText(Writer.getScript()) }
|
||||
Notifier.updateStatus("GUI script updated")
|
||||
}
|
||||
|
||||
fun getGuiScriptBuffer() = Writer.getScript()
|
||||
|
||||
}
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class GuiScriptEditorPanel implements Disposable {
|
||||
|
||||
public static final String GUI_SCRIPT_EDITOR_PLACE = "GUI_SCRIPT_EDITOR_PLACE";
|
||||
|
||||
private GuiScriptEditor myEditor;
|
||||
private final GuiScriptEditor myEditor;
|
||||
|
||||
public GuiScriptEditorPanel() {
|
||||
super();
|
||||
|
||||
Reference in New Issue
Block a user