Skip to content

Commit

Permalink
refactor: remove certain local variables in SettingsActions
Browse files Browse the repository at this point in the history
  • Loading branch information
lppedd committed Apr 12, 2020
1 parent 57723f1 commit 90fa8d6
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ internal class SettingsActions(

private inner class CompletionModeChangeAction : AnAction(Settings) {
override fun actionPerformed(e: AnActionEvent) {
val current = config.completionType
config.completionType = if (current == TEMPLATE) POPUP else TEMPLATE
config.completionType =
if (config.completionType == TEMPLATE) POPUP
else TEMPLATE
enhancer.settingSelected()
}

override fun update(e: AnActionEvent) {
val current = config.completionType
e.presentation.text = if (current == TEMPLATE) {
e.presentation.text = if (config.completionType == TEMPLATE) {
"Template ${UIUtil.rightArrow()} Standard"
} else {
"Standard ${UIUtil.rightArrow()} Template"
Expand All @@ -63,16 +63,16 @@ internal class SettingsActions(

private inner class FilterModeChangeAction : AnAction(Filter) {
override fun actionPerformed(e: AnActionEvent) {
val current = config.providerFilterType
config.providerFilterType = if (current == HIDE_SELECTED) KEEP_SELECTED else HIDE_SELECTED
config.providerFilterType =
if (config.providerFilterType == HIDE_SELECTED) KEEP_SELECTED
else HIDE_SELECTED
enhancer.settingSelected()
}

override fun update(e: AnActionEvent) {
val current = config.providerFilterType
val hideSelected = CCBundle["cc.config.popup.hideSelected"]
val keepSelected = CCBundle["cc.config.popup.keepSelected"]
e.presentation.text = if (current == HIDE_SELECTED) {
e.presentation.text = if (config.providerFilterType == HIDE_SELECTED) {
"$hideSelected ${UIUtil.rightArrow()} $keepSelected"
} else {
"$keepSelected ${UIUtil.rightArrow()} $hideSelected"
Expand Down

0 comments on commit 90fa8d6

Please sign in to comment.