in jetbrains-core/src/software/aws/toolkits/jetbrains/core/credentials/ConnectionSettingsMenuBuilder.kt [40:76]
fun build(): DefaultActionGroup {
val topLevelGroup = DefaultActionGroup()
val regionActions = createRegionActions()
val regionSettings = regionSelectionSettings
val recentRegions = accountSettingsManager?.recentlyUsedRegions()
if (recentRegions?.isNotEmpty() == true && regionSettings != null) {
topLevelGroup.add(Separator.create(message("settings.regions.recent")))
recentRegions.forEach {
topLevelGroup.add(SwitchRegionAction(it, it == regionSettings.currentSelection, regionSettings.onChange))
}
val allRegionsGroup = DefaultActionGroup.createPopupGroup { message("settings.regions.region_sub_menu") }
allRegionsGroup.addAll(regionActions)
topLevelGroup.add(allRegionsGroup)
} else {
topLevelGroup.addAll(regionActions)
}
val profileActions = createProfileActions()
val credentialsSettings = credentialsSelectionSettings
val recentCredentials = accountSettingsManager?.recentlyUsedCredentials()
if (recentCredentials?.isNotEmpty() == true && credentialsSettings != null) {
topLevelGroup.add(Separator.create(message("settings.credentials.recent")))
recentCredentials.forEach {
topLevelGroup.add(SwitchCredentialsAction(it, it == credentialsSettings.currentSelection, credentialsSettings.onChange))
}
val allCredentialsGroup = DefaultActionGroup.createPopupGroup { message("settings.credentials.profile_sub_menu") }
allCredentialsGroup.addAll(profileActions)
topLevelGroup.add(allCredentialsGroup)
} else {
topLevelGroup.addAll(profileActions)
}
return topLevelGroup
}