From 8ac2ff192aba173683eb3f91b4114f68eecfc7c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 19 Nov 2022 13:45:54 +0100 Subject: [PATCH] Clear pinned items tool. --- .../jpexs/decompiler/flash/gui/MainFrameMenu.java | 5 +++++ src/com/jpexs/decompiler/flash/gui/MainPanel.java | 4 ++++ src/com/jpexs/decompiler/flash/gui/PinsPanel.java | 13 +++++++++++++ .../flash/gui/locales/MainFrame.properties | 4 +++- .../flash/gui/locales/MainFrame_cs.properties | 4 +++- 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index f892e7d3f..c18e59b6b 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -490,6 +490,10 @@ public abstract class MainFrameMenu implements MenuBuilder { protected void clearRecentSearchesActionPerformed(ActionEvent evt) { Main.searchResultsStorage.clear(); } + + protected void clearPinnedItemsActionPerformed(ActionEvent evt) { + mainFrame.getPanel().destroyPins(); + } protected void removeNonScripts() { mainFrame.getPanel().removeNonScripts(swf); @@ -1073,6 +1077,7 @@ public abstract class MainFrameMenu implements MenuBuilder { addMenuItem("/settings/advancedSettings/advancedSettings", translate("menu.advancedsettings.advancedsettings"), "settings32", this::advancedSettingsActionPerformed, PRIORITY_TOP, null, true, null, false); addMenuItem("/settings/advancedSettings/clearRecentFiles", translate("menu.tools.otherTools.clearRecentFiles"), "clearrecent16", this::clearRecentFilesActionPerformed, PRIORITY_MEDIUM, null, true, null, false); addMenuItem("/settings/advancedSettings/clearRecentSearches", translate("menu.tools.otherTools.clearRecentSearches"), "clearrecent16", this::clearRecentSearchesActionPerformed, PRIORITY_MEDIUM, null, true, null, false); + addMenuItem("/settings/advancedSettings/clearPinnedItems", translate("menu.tools.otherTools.clearPinnedItems"), "clearrecent16", this::clearPinnedItemsActionPerformed, PRIORITY_MEDIUM, null, true, null, false); finishMenu("/settings/advancedSettings"); finishMenu("/settings"); diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 074cad4da..af72e75a7 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -418,6 +418,10 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se pinsPanel.clear(); } + public void destroyPins() { + pinsPanel.destroy(); + } + private void handleTreeKeyReleased(KeyEvent e) { AbstractTagTree tree = (AbstractTagTree) e.getSource(); if ((e.getKeyCode() == KeyEvent.VK_UP diff --git a/src/com/jpexs/decompiler/flash/gui/PinsPanel.java b/src/com/jpexs/decompiler/flash/gui/PinsPanel.java index 40b7b21ad..fd4d60a0a 100644 --- a/src/com/jpexs/decompiler/flash/gui/PinsPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/PinsPanel.java @@ -61,6 +61,19 @@ public class PinsPanel extends JPanel { setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); } + /** + * Totally destroy and save empty + */ + public void destroy() { + items.clear(); + rebuild(); + save(); + } + + /** + * Removes all items reference, saves them as paths. + * + */ public void clear() { for (TreeItem item : items) { String tagTreePath = mainPanel.tagTree.getItemPathString(item); diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 25a81a02c..72721355a 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -974,4 +974,6 @@ pin = Click to pin this item unpin = Pinned - click to unpin this item. contextmenu.unpin = Unpin contextmenu.unpin.all = Unpin all -contextmenu.unpin.others = Unpin others \ No newline at end of file +contextmenu.unpin.others = Unpin others + +menu.tools.otherTools.clearPinnedItems = Clear pinned items \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties index 018272265..7b7eddd97 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_cs.properties @@ -946,4 +946,6 @@ pin = Kliknut\u00edm tuto polo\u017eku p\u0159ipnete unpin = P\u0159ipnuto - kliknut\u00edm tuto polo\u017eku odepnete. contextmenu.unpin = Odepnout contextmenu.unpin.all = Odepnout v\u0161e -contextmenu.unpin.others = Odepnout ostatn\u00ed \ No newline at end of file +contextmenu.unpin.others = Odepnout ostatn\u00ed + +menu.tools.otherTools.clearPinnedItems = Vymazat p\u0159ipnut\u00e9 polo\u017eky \ No newline at end of file