[java-import] IJ-CR-154238 IDEA-366850 Exception on adding auto-import of static member in completion

- move to BGT

GitOrigin-RevId: d42fe4da54b6424cfe2499f2a62daccda6e56916
This commit is contained in:
Mikhail Pyltsin
2025-02-04 20:23:25 +00:00
committed by intellij-monorepo-bot
parent 51e3c71158
commit cf99cef8c7
@@ -1,7 +1,10 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.util;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.ReadAction;
import com.intellij.util.TextWithIcon;
import com.intellij.util.concurrency.AppExecutorUtil;
import com.intellij.util.ui.NamedColorUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.ApiStatus;
@@ -43,20 +46,23 @@ public /*final*/ class PsiElementModuleRenderer extends DefaultListCellRenderer
private void customizeCellRenderer(Object value, boolean selected) {
myText = "";
TextWithIcon textWithIcon = myTextWithIconProvider.apply(value);
if (textWithIcon != null) {
myText = textWithIcon.getText();
setIcon(textWithIcon.getIcon());
}
else {
myText = "";
}
ReadAction.nonBlocking(() -> {
return myTextWithIconProvider.apply(value);
}).finishOnUiThread(ModalityState.current(), textWithIcon -> {
if (textWithIcon != null) {
myText = textWithIcon.getText();
setIcon(textWithIcon.getIcon());
}
else {
myText = "";
}
setText(myText);
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, UIUtil.getListCellHPadding()));
setHorizontalTextPosition(SwingConstants.LEFT);
setHorizontalAlignment(SwingConstants.RIGHT); // align icon to the right
setBackground(selected ? UIUtil.getListSelectionBackground(true) : UIUtil.getListBackground());
setForeground(selected ? NamedColorUtil.getListSelectionForeground(true) : NamedColorUtil.getInactiveTextColor());
setText(myText);
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, UIUtil.getListCellHPadding()));
setHorizontalTextPosition(SwingConstants.LEFT);
setHorizontalAlignment(SwingConstants.RIGHT); // align icon to the right
setBackground(selected ? UIUtil.getListSelectionBackground(true) : UIUtil.getListBackground());
setForeground(selected ? NamedColorUtil.getListSelectionForeground(true) : NamedColorUtil.getInactiveTextColor());
}).submit(AppExecutorUtil.getAppExecutorService());
}
}