diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ac6a7926..0210090b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ All notable changes to this project will be documented in this file. - [#2375] Added limit of simultaneously played sounds - AS1/2 - Push action hilighting, GetProperty, Call action hilighting - [#2381] Font color values with alpha allowed in html edittext, but alpha ignored -- [#2384] Vanishing pins on AS3 code editing save +- [#2384] Vanishing pins on AS3 code editing save, on script deletion and few other cases ## [22.0.1] - 2024-11-20 ### Added diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 75934efb2..abec903fa 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -500,6 +500,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se public void replaceItemPin(TreeItem oldItem, TreeItem newItem) { pinsPanel.replaceItem(oldItem, newItem); } + + public void refreshPinnedScriptPacks() { + pinsPanel.refreshScriptPacks(); + } private void handleKeyReleased(KeyEvent e) { if (checkEdited()) { @@ -1878,6 +1882,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se if (tp != null) { getCurrentTree().setSelectionPath(tp); } + refreshPinnedScriptPacks(); } private boolean isFilterEmpty(String filter) { diff --git a/src/com/jpexs/decompiler/flash/gui/PinsPanel.java b/src/com/jpexs/decompiler/flash/gui/PinsPanel.java index 1c66885d9..8d9f683a8 100644 --- a/src/com/jpexs/decompiler/flash/gui/PinsPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PinsPanel.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.gui; +import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.tagtree.TreeRoot; import com.jpexs.decompiler.flash.timeline.TagScript; @@ -25,6 +26,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.regex.Pattern; import javax.swing.BorderFactory; import javax.swing.JPanel; @@ -448,4 +450,20 @@ public class PinsPanel extends JPanel { currentUnpinnedButton.refresh(); } } + + public void refreshScriptPacks() { + for (int b = 0; b < buttons.size(); b++) { + PinButton button = buttons.get(b); + if (button.getItem() instanceof ScriptPack) { + ScriptPack sp = (ScriptPack) button.getItem(); + List packs = sp.abc.getScriptPacks(null, sp.allABCs); + for (ScriptPack sp2 : packs) { + if (Objects.equals(sp.getClassPath(), sp2.getClassPath())) { + replaceItem(sp, sp2); + break; + } + } + } + } + } } diff --git a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java index 89ee72280..c0d5d20db 100644 --- a/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/abc/ABCPanel.java @@ -1737,7 +1737,7 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener