mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix empty splitter when reloading in presence of invalid/missing files
This commit is contained in:
+21
-12
@@ -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<Element> children = leaf.getChildren("file");
|
||||
VirtualFile currentFile = null;
|
||||
for (final Element file : children) {
|
||||
//noinspection unchecked
|
||||
final List<Element> 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user