From 4167fde28686489e0926621658809b4ff52c2fb9 Mon Sep 17 00:00:00 2001 From: Honfika Date: Sat, 28 Dec 2013 16:01:48 +0100 Subject: [PATCH] Issue #457 Clear all recent opened files + Close menu item --- .../flash/configuration/Configuration.java | 2 +- .../com/jpexs/decompiler/flash/gui/Main.java | 5 +++ .../flash/gui/MainFrameRibbonMenu.java | 32 +++++++++++++++++- .../decompiler/flash/gui/graphics/close16.png | Bin 0 -> 695 bytes .../decompiler/flash/gui/graphics/close32.png | Bin 0 -> 1886 bytes .../flash/gui/locales/MainFrame.properties | 6 ++++ .../flash/gui/locales/MainFrame_hu.properties | 6 ++++ 7 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/graphics/close16.png create mode 100644 trunk/src/com/jpexs/decompiler/flash/gui/graphics/close32.png diff --git a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 16a0c956f..06117f86a 100644 --- a/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/trunk/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -260,7 +260,7 @@ public class Configuration { public static List getRecentFiles() { String files = recentFiles.get(); - if (files == null) { + if (files == null || files.isEmpty()) { return new ArrayList<>(); } return Arrays.asList(files.split("::")); diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java index 1b2d983c2..6e896ffb6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/Main.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/Main.java @@ -462,6 +462,11 @@ public class Main { mainFrame.getPanel().close(swf); } + public static void closeAll() { + sourceInfos.clear(); + mainFrame.getPanel().closeAll(); + } + public static boolean saveFileDialog(SWF swf) { return saveFileDialog(swf, ".swf"); } diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java index c33dee1ff..59a2014a3 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java +++ b/trunk/src/com/jpexs/decompiler/flash/gui/MainFrameRibbonMenu.java @@ -35,6 +35,7 @@ import java.util.Timer; import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JCheckBoxMenuItem; import javax.swing.JOptionPane; @@ -88,6 +89,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { static final String ACTION_SAVE_AS = "SAVEAS"; static final String ACTION_SAVE_AS_EXE = "SAVEASEXE"; static final String ACTION_OPEN = "OPEN"; + static final String ACTION_CLOSE = "CLOSE"; + static final String ACTION_CLOSE_ALL = "CLOSEALL"; static final String ACTION_EXPORT_FLA = "EXPORTFLA"; public static final String ACTION_EXPORT_SEL = "EXPORTSEL"; static final String ACTION_EXPORT = "EXPORT"; @@ -101,6 +104,7 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { static final String ACTION_DEOBFUSCATE_ALL = "DEOBFUSCATEALL"; static final String ACTION_REMOVE_NON_SCRIPTS = "REMOVENONSCRIPTS"; static final String ACTION_REFRESH_DECOMPILED = "REFRESHDECOMPILED"; + static final String ACTION_CLEAR_RECENT_FILES = "CLEARRECENTFILES"; private MainFrameRibbon mainFrame; @@ -125,10 +129,13 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { private JCommandButton deobfuscationCommandButton; private JCommandButton searchCommandButton; private JCommandButton gotoDocumentClassCommandButton; + private JCommandButton clearRecentFilesCommandButton; RibbonApplicationMenuEntryPrimary exportFlaMenu; RibbonApplicationMenuEntryPrimary exportAllMenu; RibbonApplicationMenuEntryPrimary exportSelMenu; + RibbonApplicationMenuEntryPrimary closeFileMenu; + RibbonApplicationMenuEntryPrimary closeAllFilesMenu; public MainFrameRibbonMenu(MainFrameRibbon mainFrame, JRibbon ribbon, boolean externalFlashPlayerUnavailable) { this.mainFrame = mainFrame; @@ -181,6 +188,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { RibbonApplicationMenuEntryPrimary checkUpdatesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("update32"), translate("menu.help.checkupdates"), new ActionRedirector(this, ACTION_CHECK_UPDATES), JCommandButton.CommandButtonKind.ACTION_ONLY); RibbonApplicationMenuEntryPrimary aboutMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("about32"), translate("menu.help.about"), new ActionRedirector(this, ACTION_ABOUT), JCommandButton.CommandButtonKind.ACTION_ONLY); RibbonApplicationMenuEntryPrimary openFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("open32"), translate("menu.file.open"), new ActionRedirector(this, ACTION_OPEN), JCommandButton.CommandButtonKind.ACTION_AND_POPUP_MAIN_ACTION); + closeFileMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.close"), new ActionRedirector(this, ACTION_CLOSE), JCommandButton.CommandButtonKind.ACTION_ONLY); + closeAllFilesMenu = new RibbonApplicationMenuEntryPrimary(View.getResizableIcon("close32"), translate("menu.file.closeAll"), new ActionRedirector(this, ACTION_CLOSE_ALL), JCommandButton.CommandButtonKind.ACTION_ONLY); openFileMenu.setRolloverCallback(new RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback() { @Override public void menuEntryActivated(JPanel targetPanel) { @@ -219,6 +228,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { RibbonApplicationMenuEntryFooter exitMenu = new RibbonApplicationMenuEntryFooter(View.getResizableIcon("exit32"), translate("menu.file.exit"), new ActionRedirector(this, "EXIT")); mainMenu.addMenuEntry(openFileMenu); + mainMenu.addMenuEntry(closeFileMenu); + mainMenu.addMenuEntry(closeAllFilesMenu); mainMenu.addMenuSeparator(); mainMenu.addMenuEntry(exportFlaMenu); mainMenu.addMenuEntry(exportAllMenu); @@ -334,7 +345,15 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { deobfuscationBand.addCommandButton(globalrenameCommandButton, RibbonElementPriority.MEDIUM); deobfuscationBand.addCommandButton(renameinvalidCommandButton, RibbonElementPriority.MEDIUM); - return new RibbonTask(translate("menu.tools"), toolsBand, deobfuscationBand); + JRibbonBand otherToolsBand = new JRibbonBand(translate("menu.tools.otherTools"), null); + otherToolsBand.setResizePolicies(getResizePolicies(otherToolsBand)); + + clearRecentFilesCommandButton = new JCommandButton(fixCommandTitle(translate("menu.tools.otherTools.clearRecentFiles")), View.getResizableIcon("deobfuscate32")); + assignListener(clearRecentFilesCommandButton, ACTION_CLEAR_RECENT_FILES); + + otherToolsBand.addCommandButton(clearRecentFilesCommandButton, RibbonElementPriority.MEDIUM); + + return new RibbonTask(translate("menu.tools"), toolsBand, deobfuscationBand, otherToolsBand); } private RibbonTask createSettingsRibbonTask(boolean externalFlashPlayerUnavailable) { @@ -461,6 +480,8 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { exportAllMenu.setEnabled(swfLoaded); exportFlaMenu.setEnabled(swfLoaded); exportSelMenu.setEnabled(swfLoaded); + closeFileMenu.setEnabled(swfLoaded); + closeAllFilesMenu.setEnabled(swfLoaded); saveCommandButton.setEnabled(swfLoaded); saveasCommandButton.setEnabled(swfLoaded); @@ -562,6 +583,9 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { miAutoDeobfuscation.setSelected(!miAutoDeobfuscation.isSelected()); } break; + case ACTION_CLEAR_RECENT_FILES: + Configuration.recentFiles.set(null); + break; case ACTION_EXIT: mainFrame.panel.setVisible(false); if (Main.proxyFrame != null) { @@ -622,6 +646,12 @@ public class MainFrameRibbonMenu implements MainFrameMenu, ActionListener { case ACTION_OPEN: Main.openFileDialog(); break; + case ACTION_CLOSE: + Main.closeFile(mainFrame.panel.getCurrentSwf()); + break; + case ACTION_CLOSE_ALL: + Main.closeAll(); + break; case ACTION_EXPORT_FLA: mainFrame.panel.exportFla(mainFrame.panel.getCurrentSwf()); break; diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close16.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close16.png new file mode 100644 index 0000000000000000000000000000000000000000..ace289edd9f926ac7efbb4fdec05a31bebff5c50 GIT binary patch literal 695 zcmV;o0!aOdP)QxDlb83q-g)V>(Fk^6xXjEs=gr)Cm*Fo<^mL4I$34wC5BNF8n89S}#-XQ~^YvJP z0rP`oZ*;)1tns$P{b=pl2d$+AUX=r8v50)?1wKtaf~=~8v8iq7@iUs@V!3vC9|bnoZDKlrp!MjH|$pBKJ@cq?f{ zCVHcD`}cGp5YXv%Ya$H|FfqRb!>HoL)()ikK8 z3Pm`bUM%udCmi94x3Wgy;_K{9I_=cV)$Lo`5e|pMWd*@_tw+Z&FrWK^cOU1F`1W(y z$NMAr)+~I-tpmF*Y*Lkz;vzI~AHmE;%f37G?9C++ycJ$*c#U-y5x&t|@v6DP3x3=6 d&-s@C0{~E>2o(vq?o0px002ovPDHLkV1inyM1%kU literal 0 HcmV?d00001 diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close32.png b/trunk/src/com/jpexs/decompiler/flash/gui/graphics/close32.png new file mode 100644 index 0000000000000000000000000000000000000000..30a45b821c6739e81891184332a263cf725e9af1 GIT binary patch literal 1886 zcmV-k2ch_hP)<# z`z>N=cJDg$-ERPfPEV?^2R}x6Xb{zjaX8Bb&U^4Q;cMv>qMcocALxOxcR&1M z0hNV3MlSvbh1tdYlb41%>B;(L9MIo6a$xe{nG@NzC%z;jbS9=S|CiU{l}eNsjeJq% znXkW?6TaukEUAe&TAw}%HIqRtH--F-QA`Yu%slzt^*#4Hp?m`TX!q@dr;fL^J${Vt z3aktaVCDVyAPhqS%czwHBrZG>cEqpO(b(6IrpF$qjNQV_@EE3sCuS)VyVpCRu0Qj? zAMJTHd+@*$dru#i;KlRjVP3ro(GZ2u^dNE}2>$`X_XIyfS<*Dvvw3)T?;>%y9}%wt zbGelGdU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Ae#U%7}p z#X09_1p@yX*`6dRaQS`eT28{-O6MQ@_y6?s@rD!aojb9kg_=~HwwYv_*6viWO02$= zu#9sow!l5-ulhx^gyms<2qj;;qBMj>Z{rM z`+Dd|oP;J7k|fc!NqX;MQdLOqh9omX;QDr7PXAX%3|^zcA$Gs6ACjvYlG)vi(fb%707*qoM6N<$f(2Nb;{X5v literal 0 HcmV?d00001 diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties index 292f22500..f6acaffbe 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame.properties @@ -386,3 +386,9 @@ filter.exe = Executable files (*.exe) #after version 1.8.0 font.updateTexts = Update texts + +#after version 1.8.0u1 +menu.file.close = Close +menu.file.closeAll = Close all +menu.tools.otherTools = Other +menu.tools.otherTools.clearRecentFiles = Clear recent files diff --git a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties index 629102688..71a9bec1f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties +++ b/trunk/src/com/jpexs/decompiler/flash/gui/locales/MainFrame_hu.properties @@ -386,3 +386,9 @@ filter.exe = Futtathat\u00f3 f\u00e1jlok (*.exe) #after version 1.8.0 font.updateTexts = Sz\u00f6vegek friss\u00edt\u00e9se + +#after version 1.8.0u1 +menu.file.close = Bez\u00e1r\u00e1s +menu.file.closeAll = Minden bez\u00e1r\u00e1sa +menu.tools.otherTools = Egy\u00e9b +menu.tools.otherTools.clearRecentFiles = El\u0151zm\u00e9nyek t\u00f6rl\u00e9se