Added: "Show detail" context menu item for items in folder preview

This commit is contained in:
Jindra Petřík
2025-05-25 16:11:01 +02:00
parent b8adecdc6c
commit 13453cc508
10 changed files with 60 additions and 27 deletions
+1
View File
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
- [#1418] Option to make main window Always on top
- [#289] Support for Aero Snap on Windows
- [#2412] Show coordinates on stage mouse move for up to 2 decimal places
- "Show detail" context menu item for items in folder preview
### Fixed
- [#2456] FLA export - NullPointer exception while exporting to CS4 or lower via commandline
@@ -19,7 +19,6 @@ 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.Tag;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.flash.treeitems.TreeItem;
import com.jpexs.helpers.SerializableImage;
import java.awt.Color;
@@ -110,11 +109,7 @@ public class FolderListPanel extends JPanel {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 1) {
if (selectedIndex > -1) {
TreeItem selectedItem = FolderListPanel.this.items.get(selectedIndex);
TreePath subPath = parentPath.pathByAddingChild(selectedItem);
mainPanel.getCurrentTree().setSelectionPath(subPath);
}
goToSelection();
}
}
@@ -158,7 +153,7 @@ public class FolderListPanel extends JPanel {
}
if (SwingUtilities.isRightMouseButton(e)) {
mainPanel.getContextPopupMenu().update(getSelectedItemsSorted());
mainPanel.getContextPopupMenu().update(getSelectedItemsSorted(), true);
mainPanel.getContextPopupMenu().show(FolderListPanel.this, e.getX(), e.getY());
}
repaint();
@@ -167,6 +162,14 @@ public class FolderListPanel extends JPanel {
setFocusable(true);
}
public void goToSelection() {
if (selectedIndex > -1) {
TreeItem selectedItem = FolderListPanel.this.items.get(selectedIndex);
TreePath subPath = parentPath.pathByAddingChild(selectedItem);
mainPanel.getCurrentTree().setSelectionPath(subPath);
}
}
public synchronized void setItems(TreePath parentPath, List<TreeItem> items) {
this.items = items;
this.parentPath = parentPath;
@@ -105,9 +105,7 @@ public class FolderPreviewPanel extends JPanel {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() > 1) {
if (selectedIndex > -1) {
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), FolderPreviewPanel.this.items.get(selectedIndex));
}
goToSelection();
}
}
@@ -151,7 +149,7 @@ public class FolderPreviewPanel extends JPanel {
}
if (SwingUtilities.isRightMouseButton(e)) {
mainPanel.getContextPopupMenu().update(getSelectedItemsSorted());
mainPanel.getContextPopupMenu().update(getSelectedItemsSorted(), true);
mainPanel.getContextPopupMenu().show(FolderPreviewPanel.this, e.getX(), e.getY());
}
repaint();
@@ -160,6 +158,12 @@ public class FolderPreviewPanel extends JPanel {
setFocusable(true);
}
public void goToSelection() {
if (selectedIndex > -1) {
mainPanel.setTagTreeSelectedNode(mainPanel.getCurrentTree(), FolderPreviewPanel.this.items.get(selectedIndex));
}
}
public synchronized void setItems(List<TreeItem> items) {
this.items = items;
executor.shutdownNow();
@@ -636,7 +636,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
if ((e.getKeyCode() == KeyEvent.VK_DELETE) && !e.isControlDown() && !e.isAltDown()) {
if (contextPopupMenu.canRemove(items)) {
contextPopupMenu.update(items);
contextPopupMenu.update(items, false);
contextPopupMenu.removeItemActionPerformed(null, e.isShiftDown());
}
}
@@ -682,10 +682,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
}
if (e.getKeyCode() == 'X' && allWritable) {
if (!frameItems.isEmpty()) {
contextPopupMenu.update(frameItems);
contextPopupMenu.update(frameItems, false);
contextPopupMenu.cutTagOrFrameToClipboardActionPerformed(null);
} else {
contextPopupMenu.update(tagItems);
contextPopupMenu.update(tagItems, false);
if (e.isShiftDown()) {
contextPopupMenu.cutTagToClipboardWithDependenciesActionPerformed(null);
} else {
@@ -712,7 +712,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
return;
}
}
contextPopupMenu.update(items);
contextPopupMenu.update(items, false);
if (e.isShiftDown()) {
contextPopupMenu.pasteAfterActionPerformed(null);
} else {
@@ -129,7 +129,7 @@ public class PinButton extends JPanel {
}
List<TreeItem> itemList = new ArrayList<>();
itemList.add(item);
mainPanel.getContextPopupMenu().update(itemList);
mainPanel.getContextPopupMenu().update(itemList, false);
mainPanel.getContextPopupMenu().show(PinButton.this, 0, PinButton.this.getHeight());
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 487 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

@@ -1056,3 +1056,5 @@ contextmenu.showInEasy = Show in Simple editor
work.debugging.start = Starting Flash content debugger
menu.file.view.alwaysOnTop = Always on top
contextmenu.showDetail = Show detail
@@ -1055,3 +1055,5 @@ contextmenu.showInEasy = Zobrazit v Jednoduch\u00e9m editoru
#after 23.0.1
work.debugging.start = Spou\u0161t\u00ed se Flash content debugger
menu.file.view.alwaysOnTop = V\u017edy navrchu
contextmenu.showDetail = Zobrazit detail
@@ -311,6 +311,8 @@ public class TagTreeContextMenu extends JPopupMenu {
private JMenuItem moveTagMenuItem;
private JMenuItem showDetailMenuItem;
private JMenuItem showInResourcesViewTagMenuItem;
private JMenuItem showInTagListViewTagMenuItem;
@@ -373,6 +375,12 @@ public class TagTreeContextMenu extends JPopupMenu {
public TagTreeContextMenu(final List<AbstractTagTree> trees, MainPanel mainPanel) {
this.mainPanel = mainPanel;
showDetailMenuItem = new JMenuItem(mainPanel.translate("contextmenu.showDetail"));
showDetailMenuItem.addActionListener(this::showDetailActionPerformed);
showDetailMenuItem.setIcon(View.getIcon("detail16"));
add(showDetailMenuItem);
addSeparator();
expandRecursiveMenuItem = new JMenuItem(mainPanel.translate("contextmenu.expandAll"));
expandRecursiveMenuItem.addActionListener(this::expandRecursiveActionPerformed);
expandRecursiveMenuItem.setIcon(View.getIcon("expand16"));
@@ -905,7 +913,7 @@ public class TagTreeContextMenu extends JPopupMenu {
li.add(item);
}
update(li);
update(li, false);
show(e.getComponent(), e.getX(), e.getY());
}
}
@@ -1002,7 +1010,7 @@ public class TagTreeContextMenu extends JPopupMenu {
return true;
}
public void update(final List<TreeItem> items) {
public void update(final List<TreeItem> items, boolean inFolder) {
if (items.isEmpty()) {
return;
@@ -1321,6 +1329,7 @@ public class TagTreeContextMenu extends JPopupMenu {
addAs3ClassMenuItem.setVisible(false);
textSearchMenuItem.setVisible(hasScripts || hasTexts);
moveTagMenuItem.setVisible(items.size() == 1 && (items.get(0) instanceof Tag));
showDetailMenuItem.setVisible(false);
showInResourcesViewTagMenuItem.setVisible(false);
showInTagListViewTagMenuItem.setVisible(false);
showInHexDumpViewTagMenuItem.setVisible(false);
@@ -1531,10 +1540,12 @@ public class TagTreeContextMenu extends JPopupMenu {
}
}
if (!inFolder) {
if (tree.getModel().getChildCount(firstItem) > 0) {
expandRecursiveMenuItem.setVisible(true);
collapseRecursiveMenuItem.setVisible(true);
}
}
if (firstItem instanceof SWF) {
SWF swf = (SWF) firstItem;
@@ -1605,6 +1616,10 @@ public class TagTreeContextMenu extends JPopupMenu {
addFramesAfterMenuItem.setVisible(true);
}
if (inFolder) {
showDetailMenuItem.setVisible(true);
}
if (mainPanel.getCurrentView() == MainPanel.VIEW_TAGLIST
&& !(firstItem instanceof ShowFrameTag)
&& !(firstItem instanceof AS3Package)) {
@@ -4391,6 +4406,12 @@ public class TagTreeContextMenu extends JPopupMenu {
mainPanel.updateMenu();
}
private void showDetailActionPerformed(ActionEvent evt) {
//Go to one of the panels. The other is always empty, so call both.
mainPanel.folderPreviewPanel.goToSelection();
mainPanel.folderListPanel.goToSelection();
}
private void showInResourcesViewActionPerformed(ActionEvent evt) {
TreeItem item = getCurrentItem();
mainPanel.showView(MainPanel.VIEW_RESOURCES);