From ba596c3698f8bd955ce9461c38d81d5256751a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Mon, 23 Sep 2024 09:43:09 +0200 Subject: [PATCH] Fixed: #2315 AS3 direct editation - switching scripts during editation causing missing scripts --- CHANGELOG.md | 2 ++ src/com/jpexs/decompiler/flash/gui/MainPanel.java | 11 +++-------- src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java | 10 ++++++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 453f1e26c..4bff8167d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ All notable changes to this project will be documented in this file. - AS3 empty interface indentation - [#2313] AS3 direct editation - parsing class traits metadata - [#2314] AS3 direct editation - cannot save class initializer in some cases +- [#2315] AS3 direct editation - switching scripts during editation causing missing scripts ## [21.0.5] - 2024-09-05 ### Fixed @@ -3584,6 +3585,7 @@ Major version of SWF to XML export changed to 2. [#2296]: https://www.free-decompiler.com/flash/issues/2296 [#2313]: https://www.free-decompiler.com/flash/issues/2313 [#2314]: https://www.free-decompiler.com/flash/issues/2314 +[#2315]: https://www.free-decompiler.com/flash/issues/2315 [#2293]: https://www.free-decompiler.com/flash/issues/2293 [#2294]: https://www.free-decompiler.com/flash/issues/2294 [#2299]: https://www.free-decompiler.com/flash/issues/2299 diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index fa7756797..c7343827e 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -5387,6 +5387,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se updateUi(); } + clearEditingStatus(); reload(false, false); if (source == dumpTree) { @@ -6083,10 +6084,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se final ScriptPack scriptLeaf = ((AS3Package) treeItem).getCompoundInitializerPack(); if (Main.isInited() && (!Main.isWorking() || Main.isDebugging())) { ABCPanel abcPanel = getABCPanel(); - abcPanel.detailPanel.methodTraitPanel.methodCodePanel.clear(); - abcPanel.setAbc(scriptLeaf.abc); - abcPanel.decompiledTextArea.setScript(scriptLeaf, true); - abcPanel.decompiledTextArea.setNoTrait(); + abcPanel.setScript(scriptLeaf); abcPanel.setCompound(true); } @@ -6100,10 +6098,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se final ScriptPack scriptLeaf = (ScriptPack) treeItem; if (Main.isInited() && (!Main.isWorking() || Main.isDebugging())) { ABCPanel abcPanel = getABCPanel(); - abcPanel.detailPanel.methodTraitPanel.methodCodePanel.clear(); - abcPanel.setAbc(scriptLeaf.abc); - abcPanel.decompiledTextArea.setScript(scriptLeaf, true); - abcPanel.decompiledTextArea.setNoTrait(); + abcPanel.setScript(scriptLeaf); abcPanel.setCompound(!scriptLeaf.isSimple); } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 3c15c8dda..decda4079 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -2102,4 +2102,14 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener