From ee2e304070d29c5d643dd029667208b0545f451f Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 26 Nov 2013 13:31:24 +0100 Subject: [PATCH] IDEA-117073 Recent files and Switcher are not centred in ide window (cherry picked from commit 0ef7db25bb00aeda9a8bdb58f9a8635a95140b12) --- .../src/com/intellij/ide/actions/Switcher.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java index 45f0da6dd5ab..56a001ccb974 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/Switcher.java @@ -490,9 +490,9 @@ public class Switcher extends AnAction implements DumbAware { this.add(toolWindows, BorderLayout.WEST); if (filesModel.size() > 0) { files.setAlignmentY(1f); - if (files.getModel().getSize() > 30) { + if (files.getModel().getSize() > 20) { final JScrollPane pane = ScrollPaneFactory.createScrollPane(files, true); - pane.setPreferredSize(new Dimension(files.getPreferredSize().width + 10, 30 * 20)); + pane.setPreferredSize(new Dimension(files.getPreferredSize().width + 10, 20 * 20)); pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); this.add(pane, BorderLayout.EAST); } else { @@ -556,16 +556,9 @@ public class Switcher extends AnAction implements DumbAware { }.registerCustomShortcutSet(CustomShortcutSet.fromString("ESCAPE"), this, myPopup); } - Component comp = null; - final EditorWindow result = FileEditorManagerEx.getInstanceEx(project).getActiveWindow().getResult(); - if (result != null) { - comp = result.getOwner(); - } - if (comp == null) { - comp = ideFrame.getContentPane(); - } + final Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, myPopup); - myPopup.showInCenterOf(comp); + myPopup.showInCenterOf(window); }