Fixed: AS2 Class names not showing in Folder list view

This commit is contained in:
Jindra Petřík
2025-05-25 18:22:48 +02:00
parent 1768395a9b
commit ceee0afb12
2 changed files with 24 additions and 12 deletions
+1
View File
@@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file.
- Proper freeing memory after SWF close - Proper freeing memory after SWF close
- AS1/2 improper selection of search result - AS1/2 improper selection of search result
- [#2459] AS1/2 StoreRegister improper declaration position - [#2459] AS1/2 StoreRegister improper declaration position
- AS2 Class names not showing in Folder list view
## [23.0.1] - 2025-05-16 ## [23.0.1] - 2025-05-16
### Fixed ### Fixed
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.gui;
import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.gui.tagtree.AbstractTagTree; 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.tags.Tag;
import com.jpexs.decompiler.flash.treeitems.TreeItem; import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.helpers.SerializableImage; import com.jpexs.helpers.SerializableImage;
@@ -161,7 +162,7 @@ public class FolderListPanel extends JPanel {
}); });
setFocusable(true); setFocusable(true);
} }
public void goToSelection() { public void goToSelection() {
if (selectedIndex > -1) { if (selectedIndex > -1) {
TreeItem selectedItem = FolderListPanel.this.items.get(selectedIndex); TreeItem selectedItem = FolderListPanel.this.items.get(selectedIndex);
@@ -178,8 +179,8 @@ public class FolderListPanel extends JPanel {
selectedItems.clear(); selectedItems.clear();
selectedIndex = -1; selectedIndex = -1;
((JScrollPane) getParent().getParent()).getVerticalScrollBar().setValue(0); ((JScrollPane) getParent().getParent()).getVerticalScrollBar().setValue(0);
} }
public void clear() { public void clear() {
items = new ArrayList<>(); items = new ArrayList<>();
selectedItems.clear(); selectedItems.clear();
@@ -243,16 +244,26 @@ public class FolderListPanel extends JPanel {
TreeNodeType type = AbstractTagTree.getTreeNodeType(treeItem); TreeNodeType type = AbstractTagTree.getTreeNodeType(treeItem);
Icon icon = ICONS.get(type); 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); 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; String s = null;
if (treeItem instanceof Tag) { if (treeItem instanceof DoInitActionTag) {
Tag t = (Tag) treeItem; DoInitActionTag tag = (DoInitActionTag) treeItem;
String uniqueId = t.getUniqueId(); String expName = tag.getSwf().getExportName(tag.getCharacterId());
s = ((Tag) treeItem).getTagName(); if (expName != null && !expName.isEmpty()) {
if (uniqueId != null) { String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
s = s + " (" + uniqueId + ")"; 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); int itemIndex = mainPanel.getCurrentTree().getFullModel().getItemIndex(treeItem);