From 1d030ac10a071d1073d01e142cf1760bb6c2e6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 28 Feb 2021 13:12:46 +0100 Subject: [PATCH] Fixed: Not selecting proper script after restoring session --- CHANGELOG.md | 1 + src/com/jpexs/decompiler/flash/gui/Main.java | 6 +++++- .../jpexs/decompiler/flash/gui/tagtree/TagTree.java | 12 ++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72c5b52c7..e0d99bdb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ All notable changes to this project will be documented in this file. - AS3 p-code/AS hilighting when outside trait - AS3 p-code/AS hilighting after p-code save - Decompilation - Goto handling +- Not selecting proper script after restoring session ### Removed - #1631 ActiveX Flash component download in windows installer diff --git a/src/com/jpexs/decompiler/flash/gui/Main.java b/src/com/jpexs/decompiler/flash/gui/Main.java index a4203c0a2..47bb3017e 100644 --- a/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/src/com/jpexs/decompiler/flash/gui/Main.java @@ -1195,7 +1195,11 @@ public class Main { SwfSpecificConfiguration swfConf = Configuration.getSwfSpecificConfiguration(fswf.getShortFileName()); if (swfConf != null) { String pathStr = swfConf.lastSelectedPath; - mainFrame.getPanel().tagTree.setSelectionPathString(pathStr); + if (isInited()) { + mainFrame.getPanel().tagTree.setSelectionPathString(pathStr); + } else { + mainFrame.getPanel().tagTree.setExpandPathString(pathStr); + } } } diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java index 4f1fb34b4..ac7acc1c7 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTree.java @@ -684,6 +684,18 @@ public class TagTree extends JTree { return sb.toString(); } + public void setExpandPathString(String pathStr) { + if (pathStr != null && pathStr.length() > 0) { + String[] path = pathStr.split("\\|"); + + TreePath tp = View.getTreePathByPathStrings(this, Arrays.asList(path)); + if (tp != null) { + // the current view is the Resources view, otherwise tp is null + mainPanel.tagTree.expandPath(tp.getParentPath()); + } + } + } + public void setSelectionPathString(String pathStr) { if (pathStr != null && pathStr.length() > 0) { String[] path = pathStr.split("\\|");