From 3f1caf45c0d152c50e7f57746799879c0a1f81b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 7 Dec 2022 18:26:16 +0100 Subject: [PATCH] Fixed Folder preview tag names have indices when multiple with same name --- CHANGELOG.md | 1 + .../jpexs/decompiler/flash/gui/FolderPreviewPanel.java | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29444812e..f41178921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ All notable changes to this project will be documented in this file. - Proper disabling switching items or other actions on editation - Raw editor item count and edit display - Warnings about invalid reflective access in color dialog on Java 9+ +- Folder preview tag names have indices when multiple with same name ### Changed - Quick search needs minimum of 3 characters diff --git a/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java b/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java index 56ac2c5b0..674fc60a8 100644 --- a/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/FolderPreviewPanel.java @@ -79,6 +79,8 @@ public class FolderPreviewPanel extends JPanel { public Map selectedItems = new HashMap<>(); private Cache cachedPreviews; + + private MainPanel mainPanel; private static final int PREVIEW_SIZE = 150; @@ -99,6 +101,7 @@ public class FolderPreviewPanel extends JPanel { public FolderPreviewPanel(final MainPanel mainPanel, List items) { this.items = items; + this.mainPanel = mainPanel; cachedPreviews = Cache.getInstance(false, false, "preview", true); addMouseListener(new MouseAdapter() { @@ -249,6 +252,12 @@ public class FolderPreviewPanel extends JPanel { } else { s = treeItem.toString(); } + + int itemIndex = mainPanel.getCurrentTree().getFullModel().getItemIndex(treeItem); + if (itemIndex > 1) { + s += " [" + itemIndex + "]"; + } + g.setFont(f); g.setColor(borderColor); g.drawLine(x * CELL_WIDTH, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE, x * CELL_WIDTH + CELL_WIDTH, y * CELL_HEIGHT + BORDER_SIZE + PREVIEW_SIZE);