From c284ca87e5deb8718f51cb51ee64e59f476db950 Mon Sep 17 00:00:00 2001 From: Ivan Semenov Date: Thu, 31 May 2018 18:50:56 +0300 Subject: [PATCH] [github] Trigger account change listener once for each change --- .../github/authentication/ui/GithubAccountCombobox.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubAccountCombobox.kt b/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubAccountCombobox.kt index 064be8eceee1..4eb82ec00ba9 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubAccountCombobox.kt +++ b/plugins/github/src/org/jetbrains/plugins/github/authentication/ui/GithubAccountCombobox.kt @@ -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, defaultAccount: GithubAccount?, @@ -17,11 +18,7 @@ class GithubAccountCombobox(accounts: Set, 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 } }