diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java index 5b3ca6a70e9d..0d03a6a7ad0c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorsSplitters.java @@ -221,6 +221,14 @@ public class EditorsSplitters extends JPanel { } mySplittersElement = null; } + // clear empty splitters + for (EditorWindow window : getWindows()) { + if (window.getEditors().length == 0) { + for (EditorWindow sibling : window.findSiblings()) { + sibling.unsplit(false); + } + } + } } } @@ -228,6 +236,7 @@ public class EditorsSplitters extends JPanel { mySplittersElement = element; } + @Nullable @SuppressWarnings({"HardCodedStringLiteral"}) public JPanel readExternalPanel(final Element element, @Nullable JPanel panel) { final Element splitterElement = element.getChild("splitter"); @@ -263,11 +272,11 @@ public class EditorsSplitters extends JPanel { } else { window = findWindowWith(panel); } - try { - //noinspection unchecked - final List children = leaf.getChildren("file"); - VirtualFile currentFile = null; - for (final Element file : children) { + //noinspection unchecked + final List children = leaf.getChildren("file"); + VirtualFile currentFile = null; + for (final Element file : children) { + try { final HistoryEntry entry = new HistoryEntry(getManager().getProject(), file.getChild(HistoryEntry.TAG)); boolean isCurrent = Boolean.valueOf(file.getAttributeValue("current")).booleanValue(); getManager().openFileImpl3(window, entry.myFile, false, entry, isCurrent); @@ -281,15 +290,15 @@ public class EditorsSplitters extends JPanel { } } } - if (currentFile != null) { - final EditorComposite editor = window.findFileComposite(currentFile); - if (editor != null) { - window.setSelectedEditor(editor, true); - } + catch (InvalidDataException e) { + // OK } } - catch (InvalidDataException e) { - // OK + if (currentFile != null) { + final EditorComposite editor = window.findFileComposite(currentFile); + if (editor != null) { + window.setSelectedEditor(editor, true); + } } return window.myPanel; }