From f1a515b268dc89712e380db237abf569b38dce6e Mon Sep 17 00:00:00 2001 From: Alexander Bubenchikov Date: Tue, 26 Jul 2022 14:46:13 +0200 Subject: [PATCH] [ui] create TextCompletionComboBox with spinner GitOrigin-RevId: c097ec1298defb0bc300bb220c5049c4b0a843e6 --- .../ui/completion/TextCompletionComboBox.kt | 2 +- .../TextCompletionComboBoxWithSpinner.kt | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/TextCompletionComboBoxWithSpinner.kt diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/TextCompletionComboBox.kt b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/TextCompletionComboBox.kt index a440af174740..f02a74bb41dd 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/TextCompletionComboBox.kt +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/TextCompletionComboBox.kt @@ -14,7 +14,7 @@ import com.intellij.ui.* import java.awt.event.KeyEvent import javax.swing.KeyStroke -class TextCompletionComboBox( +open class TextCompletionComboBox( project: Project?, private val converter: TextCompletionComboBoxConverter ) : TextCompletionField(project) { diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/TextCompletionComboBoxWithSpinner.kt b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/TextCompletionComboBoxWithSpinner.kt new file mode 100644 index 000000000000..6549f291a820 --- /dev/null +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/completion/TextCompletionComboBoxWithSpinner.kt @@ -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(project: Project?, converter: TextCompletionComboBoxConverter) : TextCompletionComboBox( + 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, { }) + + } +} \ No newline at end of file