Skip to content

Commit

Permalink
[ML4SE-220] Name fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikrise2 committed Nov 7, 2023
1 parent 6526388 commit 9ecb7b1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class MainPluginPanelFactory : ToolWindowFactory {
fun checkInputs(): Promise<Boolean> =
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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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"
Expand All @@ -51,15 +51,15 @@ 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
}

fun JButton.getState(): ButtonState = ButtonState(text, isVisible, actionListeners.firstOrNull())

fun JButton.addListener(listener: ActionListener) {
fun JButton.setListener(listener: ActionListener) {
actionListeners.forEach {
removeActionListener(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ class AgreementTemplate(private val agreements: List<Agreement>) : HtmlBaseFileT
}.joinToString("<br>")

private fun Agreement.toHtml(): String {
var text = text
text = text.replace(System.lineSeparator(), "<br>")
var html = text.replace(System.lineSeparator(), "<br>")
if (openLinkInDefaultBrowser) {
text = text.replace(HREF_PATTERN) { matchResult ->
html = html.replace(HREF_PATTERN) { matchResult ->
val href = matchResult.groupValues[1]
"""<a class="defaultBrowser" href="$href">"""
}
}
return text
return html
}

companion object {
Expand Down

0 comments on commit 9ecb7b1

Please sign in to comment.