From ceee0afb12c0567f2cd39636ce64cd5def8aaf78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 25 May 2025 18:22:48 +0200 Subject: [PATCH] Fixed: AS2 Class names not showing in Folder list view --- CHANGELOG.md | 1 + .../decompiler/flash/gui/FolderListPanel.java | 35 ++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 487354129..be0bc128d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file. - Proper freeing memory after SWF close - AS1/2 improper selection of search result - [#2459] AS1/2 StoreRegister improper declaration position +- AS2 Class names not showing in Folder list view ## [23.0.1] - 2025-05-16 ### Fixed diff --git a/src/com/jpexs/decompiler/flash/gui/FolderListPanel.java b/src/com/jpexs/decompiler/flash/gui/FolderListPanel.java index fdec9034e..1e6bbcfd4 100644 --- a/src/com/jpexs/decompiler/flash/gui/FolderListPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/FolderListPanel.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.gui.tagtree.AbstractTagTree; +import com.jpexs.decompiler.flash.tags.DoInitActionTag; import com.jpexs.decompiler.flash.tags.Tag; import com.jpexs.decompiler.flash.treeitems.TreeItem; import com.jpexs.helpers.SerializableImage; @@ -161,7 +162,7 @@ public class FolderListPanel extends JPanel { }); setFocusable(true); } - + public void goToSelection() { if (selectedIndex > -1) { TreeItem selectedItem = FolderListPanel.this.items.get(selectedIndex); @@ -178,8 +179,8 @@ public class FolderListPanel extends JPanel { selectedItems.clear(); selectedIndex = -1; ((JScrollPane) getParent().getParent()).getVerticalScrollBar().setValue(0); - } - + } + public void clear() { items = new ArrayList<>(); selectedItems.clear(); @@ -243,16 +244,26 @@ public class FolderListPanel extends JPanel { TreeNodeType type = AbstractTagTree.getTreeNodeType(treeItem); Icon icon = ICONS.get(type); icon.paintIcon(l, g, x * CELL_WIDTH + BORDER_SIZE + PREVIEW_SIZE / 2 - icon.getIconWidth() / 2, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE / 2 - icon.getIconHeight() / 2); - String s; - if (treeItem instanceof Tag) { - Tag t = (Tag) treeItem; - String uniqueId = t.getUniqueId(); - s = ((Tag) treeItem).getTagName(); - if (uniqueId != null) { - s = s + " (" + uniqueId + ")"; + String s = null; + if (treeItem instanceof DoInitActionTag) { + DoInitActionTag tag = (DoInitActionTag) treeItem; + String expName = tag.getSwf().getExportName(tag.getCharacterId()); + if (expName != null && !expName.isEmpty()) { + String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName}; + s = pathParts[pathParts.length - 1]; + } + } + if (s == null) { + if (treeItem instanceof Tag) { + Tag t = (Tag) treeItem; + String uniqueId = t.getUniqueId(); + s = ((Tag) treeItem).getTagName(); + if (uniqueId != null) { + s = s + " (" + uniqueId + ")"; + } + } else { + s = treeItem.toString(); } - } else { - s = treeItem.toString(); } int itemIndex = mainPanel.getCurrentTree().getFullModel().getItemIndex(treeItem);