From b649dba2dd3ec181439e70ece79df5bf97a1da4b Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Wed, 4 Feb 2015 19:42:19 +0300 Subject: [PATCH] Combobox in table: set popup min size via builder --- .../editors/JBComboBoxTableCellEditorComponent.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/components/editors/JBComboBoxTableCellEditorComponent.java b/platform/platform-api/src/com/intellij/ui/components/editors/JBComboBoxTableCellEditorComponent.java index 8056a6fdc12e..56529723a58e 100644 --- a/platform/platform-api/src/com/intellij/ui/components/editors/JBComboBoxTableCellEditorComponent.java +++ b/platform/platform-api/src/com/intellij/ui/components/editors/JBComboBoxTableCellEditorComponent.java @@ -141,6 +141,8 @@ public class JBComboBoxTableCellEditorComponent extends JBLabel { if (myRenderer != null) { myList.setCellRenderer(myRenderer); } + final Rectangle rect = myTable.getCellRect(myRow, myColumn, true); + Point point = new Point(rect.x, rect.y); final boolean surrendersFocusOnKeystrokeOldValue = myTable instanceof JBTable ? ((JBTable)myTable).surrendersFocusOnKeyStroke() : myTable.getSurrendersFocusOnKeystroke(); final JBPopup popup = JBPopupFactory.getInstance() .createListPopupBuilder(myList) @@ -178,12 +180,8 @@ public class JBComboBoxTableCellEditorComponent extends JBLabel { super.onClosed(event); } }) + .setMinSize(myWide ? new Dimension(((int)rect.getSize().getWidth()), -1) : null) .createPopup(); - final Rectangle rect = myTable.getCellRect(myRow, myColumn, true); - Point point = new Point(rect.x, rect.y); - if (myWide) { - popup.setMinimumSize(new Dimension(((int)rect.getSize().getWidth()), -1)); - } popup.show(new RelativePoint(myTable, point)); }