mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 14:10:46 +00:00
Issue #457 Clear all recent opened files + Close menu item
This commit is contained in:
@@ -260,7 +260,7 @@ public class Configuration {
|
||||
|
||||
public static List<String> getRecentFiles() {
|
||||
String files = recentFiles.get();
|
||||
if (files == null) {
|
||||
if (files == null || files.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return Arrays.asList(files.split("::"));
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 695 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user