From 9ecb7b1cab6e68077342020dca9f3f68f617140d Mon Sep 17 00:00:00 2001 From: mikrise2 Date: Tue, 7 Nov 2023 14:23:49 +0100 Subject: [PATCH] [ML4SE-220] Name fixes. --- .../ui/main/panel/MainPluginPanelFactory.kt | 4 ++-- .../research/tasktracker/ui/main/panel/Util.kt | 10 +++++----- .../ui/main/panel/template/AgreementTemplate.kt | 7 +++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/MainPluginPanelFactory.kt b/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/MainPluginPanelFactory.kt index 7c9b6737..cc388b12 100644 --- a/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/MainPluginPanelFactory.kt +++ b/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/MainPluginPanelFactory.kt @@ -179,7 +179,7 @@ class MainPluginPanelFactory : ToolWindowFactory { fun checkInputs(): Promise = mainWindow.executeJavaScriptAsync("allChecked()").then { it.toBoolean() } - fun setNextAction(listener: ActionListener) = nextButton.addListener(listener) + fun setNextAction(listener: ActionListener) = nextButton.setListener(listener) - fun setBackAction(listener: ActionListener) = backButton.addListener(listener) + fun setBackAction(listener: ActionListener) = backButton.setListener(listener) } diff --git a/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/Util.kt b/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/Util.kt index 7fb3be5e..8d0a00ad 100644 --- a/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/Util.kt +++ b/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/Util.kt @@ -19,7 +19,7 @@ fun MainPluginWindow.jslinkProcess(type: LinkType, action: (param: String) -> Un with(type) { val preventCode = if (prevent) { """ - link.addEventListener('click', function(event) { + link.addEventListener('click', function(event) { event.preventDefault(); }); """.trimIndent() @@ -33,9 +33,9 @@ fun MainPluginWindow.jslinkProcess(type: LinkType, action: (param: String) -> Un $preventCode link.onclick = get_link$name } - function get_link$name (){ + + function get_link$name() { link = this.getAttribute('$getAttribute'); - """, "}", "link" @@ -51,7 +51,7 @@ fun MainPluginWindow.jslinkProcess(type: LinkType, action: (param: String) -> Un */ fun JButton.changeState(buttonState: ButtonState) { buttonState.actionListener?.let { - addListener(buttonState.actionListener) + setListener(buttonState.actionListener) } this.text = buttonState.text isVisible = buttonState.isVisibleProp @@ -59,7 +59,7 @@ fun JButton.changeState(buttonState: ButtonState) { fun JButton.getState(): ButtonState = ButtonState(text, isVisible, actionListeners.firstOrNull()) -fun JButton.addListener(listener: ActionListener) { +fun JButton.setListener(listener: ActionListener) { actionListeners.forEach { removeActionListener(it) } diff --git a/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/template/AgreementTemplate.kt b/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/template/AgreementTemplate.kt index 10beae62..02975454 100644 --- a/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/template/AgreementTemplate.kt +++ b/ijPlugin/src/main/kotlin/org/jetbrains/research/tasktracker/ui/main/panel/template/AgreementTemplate.kt @@ -22,15 +22,14 @@ class AgreementTemplate(private val agreements: List) : HtmlBaseFileT }.joinToString("
") private fun Agreement.toHtml(): String { - var text = text - text = text.replace(System.lineSeparator(), "
") + var html = text.replace(System.lineSeparator(), "
") if (openLinkInDefaultBrowser) { - text = text.replace(HREF_PATTERN) { matchResult -> + html = html.replace(HREF_PATTERN) { matchResult -> val href = matchResult.groupValues[1] """""" } } - return text + return html } companion object {