From 94adb3a0a3454da872673db846723e06e9c5aac4 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 16 Sep 2011 16:19:47 +0200 Subject: [PATCH] resizeable lookup (IDEA-74401) --- .../codeInsight/lookup/impl/LookupImpl.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index 626a1fe61c88..bdcfa9446cbe 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java @@ -141,6 +141,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable super(new JPanel(new BorderLayout())); setForceShowAsPopup(true); setCancelOnClickOutside(false); + setResizable(true); myProject = project; myEditor = editor; @@ -170,7 +171,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable getComponent().add(myLayeredPane, BorderLayout.CENTER); - myLayeredPane.mainPanel.add(myScrollPane, BorderLayout.NORTH); + myLayeredPane.mainPanel.add(myScrollPane, BorderLayout.CENTER); myScrollPane.setBorder(null); myAdComponent = new Advertiser(); @@ -1356,6 +1357,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable @Override public void componentResized(ComponentEvent e) { mainPanel.setSize(getSize()); + mainPanel.validate(); layoutStatusIcons(); layoutHint(); @@ -1366,22 +1368,22 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable } private void layoutStatusIcons() { - final Dimension iconSize = myProcessIcon.getPreferredSize(); - myIconPanel.setBounds(getWidth() - iconSize.width, 0, iconSize.width, iconSize.height); - - final Dimension sortSize = mySortingLabel.getPreferredSize(); - final Point sbLocation = SwingUtilities.convertPoint(myScrollPane.getVerticalScrollBar(), 0, 0, myLayeredPane); - int adHeight = myAdComponent.getAdComponent().getPreferredSize().height; - final int sortHeight = Math.max(adHeight, mySortingLabel.getPreferredSize().height); - mySortingLabel.setBounds(sbLocation.x, getHeight() - sortHeight, sortSize.width, sortHeight); - Dimension buttonSize = adHeight > 0 ? new Dimension(0, 0) : new Dimension(relevanceSortIcon.getIconWidth(), relevanceSortIcon.getIconHeight()); myScrollBarIncreaseButton.setPreferredSize(buttonSize); myScrollBarIncreaseButton.setMinimumSize(buttonSize); myScrollBarIncreaseButton.setMaximumSize(buttonSize); myScrollPane.getVerticalScrollBar().revalidate(); myScrollPane.getVerticalScrollBar().repaint(); + + final Dimension iconSize = myProcessIcon.getPreferredSize(); + myIconPanel.setBounds(getWidth() - iconSize.width, 0, iconSize.width, iconSize.height); + + final Dimension sortSize = mySortingLabel.getPreferredSize(); + final Point sbLocation = SwingUtilities.convertPoint(myScrollPane.getVerticalScrollBar(), 0, 0, myLayeredPane); + + final int sortHeight = Math.max(adHeight, mySortingLabel.getPreferredSize().height); + mySortingLabel.setBounds(sbLocation.x, getHeight() - sortHeight, sortSize.width, sortHeight); } void layoutHint() {