mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
add standard insets to list renderer for dropdown popup
This commit is contained in:
+15
@@ -21,9 +21,12 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.ui.ClickListener;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.content.TabbedContent;
|
||||
import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
@@ -64,6 +67,18 @@ public class TabbedContentTabLabel extends ContentTabLabel {
|
||||
names.add(tab.first);
|
||||
}
|
||||
final JBList list = new JBList(names);
|
||||
list.installCellRenderer(new NotNullFunction<Object, JComponent>() {
|
||||
final JLabel label = new JLabel();
|
||||
{
|
||||
label.setBorder(new EmptyBorder(UIUtil.getListCellPadding()));
|
||||
}
|
||||
@NotNull
|
||||
@Override
|
||||
public JComponent fun(Object dom) {
|
||||
label.setText(dom.toString());
|
||||
return label;
|
||||
}
|
||||
});
|
||||
JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user