mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-06 12:45:10 +00:00
Issue #344 Reload opened swf
This commit is contained in:
@@ -304,6 +304,29 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean reloadSWF(){
|
||||
if (Main.inputStream == null) {
|
||||
mainFrame.setVisible(false);
|
||||
Helper.emptyObject(mainFrame);
|
||||
Cache.clearAll();
|
||||
System.gc();
|
||||
mainFrame = null;
|
||||
showModeFrame();
|
||||
return true;
|
||||
} else {
|
||||
if (inputStream instanceof FileInputStream) {
|
||||
openFile(file);
|
||||
} else if (inputStream instanceof BufferedInputStream) {
|
||||
try {
|
||||
((BufferedInputStream) inputStream).reset();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return openFile(fileTitle, inputStream);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public static void reloadApp() {
|
||||
if (loadingDialog != null) {
|
||||
loadingDialog.setVisible(false);
|
||||
@@ -313,16 +336,11 @@ public class Main {
|
||||
proxyFrame.setVisible(false);
|
||||
proxyFrame = null;
|
||||
}
|
||||
if (Main.file == null) {
|
||||
mainFrame.setVisible(false);
|
||||
Helper.emptyObject(mainFrame);
|
||||
Cache.clearAll();
|
||||
System.gc();
|
||||
mainFrame = null;
|
||||
showModeFrame();
|
||||
} else {
|
||||
openFile(Main.file);
|
||||
if(loadFromMemoryFrame != null){
|
||||
loadFromMemoryFrame.setVisible(false);
|
||||
loadFromMemoryFrame = null;
|
||||
}
|
||||
reloadSWF();
|
||||
}
|
||||
|
||||
public static boolean openFile(String swfFile) {
|
||||
|
||||
@@ -376,14 +376,17 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
assignListener(openCommandButton, "OPEN");
|
||||
saveCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.save")), View.getResizableIcon("save32"));
|
||||
assignListener(saveCommandButton, "SAVE");
|
||||
JCommandButton saveasCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveas")), View.getResizableIcon("saveas32"));
|
||||
JCommandButton saveasCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.saveas")), View.getResizableIcon("saveas16"));
|
||||
assignListener(saveasCommandButton, "SAVEAS");
|
||||
|
||||
JCommandButton reloadCommandButton = new JCommandButton(fixCommandTitle(translate("menu.file.reload")), View.getResizableIcon("reload16"));
|
||||
assignListener(reloadCommandButton, "RELOAD");
|
||||
|
||||
|
||||
editBand.addCommandButton(openCommandButton, RibbonElementPriority.TOP);
|
||||
editBand.addCommandButton(saveCommandButton, RibbonElementPriority.TOP);
|
||||
editBand.addCommandButton(saveasCommandButton, RibbonElementPriority.TOP);
|
||||
editBand.addCommandButton(saveasCommandButton, RibbonElementPriority.MEDIUM);
|
||||
editBand.addCommandButton(reloadCommandButton, RibbonElementPriority.MEDIUM);
|
||||
saveCommandButton.setEnabled(!Main.readOnly);
|
||||
|
||||
JRibbonBand exportBand = new JRibbonBand(translate("menu.export"), null);
|
||||
@@ -827,6 +830,7 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
exportSelMenu.setEnabled(false);
|
||||
deobfuscationCommandButton.setEnabled(false);
|
||||
searchCommandButton.setEnabled(false);
|
||||
reloadCommandButton.setEnabled(false);
|
||||
}
|
||||
|
||||
UIManager.getDefaults().put("TreeUI", BasicTreeUI.class.getName());
|
||||
@@ -2193,6 +2197,11 @@ public class MainFrame extends AppRibbonFrame implements ActionListener, TreeSel
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()) {
|
||||
case "RELOAD":
|
||||
if(View.showConfirmDialog(null, translate("message.confirm.reload"), translate("message.warning"),JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)==JOptionPane.YES_OPTION){
|
||||
Main.reloadSWF();
|
||||
}
|
||||
break;
|
||||
case "LOADMEMORY":
|
||||
Main.loadFromMemory();
|
||||
break;
|
||||
|
||||
@@ -332,4 +332,6 @@ error.font.nocharacter = Selected source font does not contain character "%char%
|
||||
warning.initializers = Static fields and consts are often initialized in initializers.\nEditing value here is usually not enough!
|
||||
|
||||
#after version 1.7.0u1:
|
||||
menu.tools.searchmemory = Search SWFs in memory
|
||||
menu.tools.searchmemory = Search SWFs in memory
|
||||
menu.file.reload = Reload
|
||||
message.confirm.reload = This action cancels all unsaved changes and reloads the SWF file again.\nDo you want to continue?
|
||||
@@ -337,4 +337,6 @@ error.font.nocharacter = Vybran\u00e9 zdrojov\u00e9 p\u00edsmo neobsahuje znak "
|
||||
warning.initializers = Statick\u00e9 atributy a konstanty jsou \u010dasto inicializov\u00e1ny pomoc\u00ed inicializ\u00e1tor\u016f.\nPokud to uprav\u00edte zde, obvykle to nesta\u010d\u00ed!
|
||||
|
||||
#after version 1.7.0u1:
|
||||
menu.tools.searchmemory = Hledat SWF v pam\u011bti
|
||||
menu.tools.searchmemory = Hledat SWF v pam\u011bti
|
||||
menu.file.reload = Znovu na\u010d\u00edst
|
||||
message.confirm.reload = Tato akce zru\u0161\u00ed v\u0161echny neulo\u017een\u00e9 zm\u011bny a znovu na\u010dte SWF soubor.\nChcete pokra\u010dovat?
|
||||
Reference in New Issue
Block a user