mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[github] Trigger account change listener once for each change
This commit is contained in:
+2
-5
@@ -4,6 +4,7 @@ package org.jetbrains.plugins.github.authentication.ui
|
||||
import com.intellij.openapi.ui.ComboBox
|
||||
import com.intellij.ui.CollectionComboBoxModel
|
||||
import org.jetbrains.plugins.github.authentication.accounts.GithubAccount
|
||||
import java.awt.event.ItemEvent
|
||||
|
||||
class GithubAccountCombobox(accounts: Set<GithubAccount>,
|
||||
defaultAccount: GithubAccount?,
|
||||
@@ -17,11 +18,7 @@ class GithubAccountCombobox(accounts: Set<GithubAccount>,
|
||||
else {
|
||||
selectedIndex = 0
|
||||
}
|
||||
if (onChange != null) {
|
||||
addItemListener {
|
||||
onChange(model.selectedItem as GithubAccount)
|
||||
}
|
||||
}
|
||||
if (onChange != null) addItemListener { if (it.stateChange == ItemEvent.SELECTED) onChange(model.selectedItem as GithubAccount) }
|
||||
isEnabled = accounts.size > 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user