fix tabs relayout in some cases (to prevent moving visible tabs) + fix tab order on reopen for "Activate right neighbouring tab on close" option

This commit is contained in:
Alexey Pegov
2011-09-19 18:27:31 +04:00
parent c4d21c225f
commit 3fece550ce
2 changed files with 13 additions and 2 deletions
@@ -294,7 +294,12 @@ public class TabLabel extends JPanel {
private void invalidateIfNeeded() {
if (myLabel.getRootPane() == null) return;
if (myLabel.getSize() != null && myLabel.getSize().equals(myLabel.getPreferredSize())) return;
Dimension d = myLabel.getSize();
Dimension pref = myLabel.getPreferredSize();
if (d != null && (d.width >= pref.width && d.height >= pref.height)) {
// do not need to invalidate if size is more than preferred size
return;
}
setInactiveStateImage(null);
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.fileEditor.impl;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.KeyboardShortcut;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.application.ModalityState;
@@ -326,8 +327,13 @@ public class EditorsSplitters extends JPanel {
window = findWindowWith(panel);
}
//noinspection unchecked
final List<Element> children = leaf.getChildren("file");
final List<Element> children = new ArrayList<Element>(leaf.getChildren("file"));
VirtualFile currentFile = null;
if (UISettings.getInstance().ACTIVATE_RIGHT_EDITOR_ON_CLOSE) {
Collections.reverse(children);
}
for (final Element file : children) {
try {
final HistoryEntry entry = new HistoryEntry(getManager().getProject(), file.getChild(HistoryEntry.TAG));