[ui] create TextCompletionComboBox with spinner

GitOrigin-RevId: c097ec1298defb0bc300bb220c5049c4b0a843e6
This commit is contained in:
Alexander Bubenchikov
2022-07-26 13:08:11 +00:00
committed by intellij-monorepo-bot
parent d09796e265
commit f1a515b268
2 changed files with 32 additions and 1 deletions
@@ -14,7 +14,7 @@ import com.intellij.ui.*
import java.awt.event.KeyEvent
import javax.swing.KeyStroke
class TextCompletionComboBox<T>(
open class TextCompletionComboBox<T>(
project: Project?,
private val converter: TextCompletionComboBoxConverter<T>
) : TextCompletionField<T>(project) {
@@ -0,0 +1,31 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.externalSystem.service.ui.completion
import com.intellij.openapi.project.Project
import com.intellij.ui.AnimatedIcon
import com.intellij.ui.SpinningProgressIcon
import com.intellij.ui.components.fields.ExtendableTextComponent
class TextCompletionComboBoxWithSpinner<T>(project: Project?, converter: TextCompletionComboBoxConverter<T>) : TextCompletionComboBox<T>(
project, converter) {
private val spinner = SpinningProgressIcon()
private val myExtension: ExtendableTextComponent.Extension
var spinning: Boolean = false
set(value) {
if (value) {
addExtension(myExtension)
}
else {
removeExtension(myExtension)
}
}
get() = field
init {
this.putClientProperty(AnimatedIcon.ANIMATION_IN_RENDERER_ALLOWED, true)
myExtension = ExtendableTextComponent.Extension.create(spinner, spinner, null, { })
}
}