IDEA-117073 Recent files and Switcher are not centred in ide window

(cherry picked from commit 0ef7db25bb00aeda9a8bdb58f9a8635a95140b12)
This commit is contained in:
Konstantin Bulenkov
2013-11-26 15:57:09 +01:00
parent 510da92613
commit ee2e304070
@@ -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);
}