mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-09 02:59:48 +00:00
Disable reload button for new unsaved files
This commit is contained in:
@@ -37,7 +37,18 @@ public class SWFSourceInfo {
|
||||
private final String fileTitle;
|
||||
|
||||
private final boolean detectBundle;
|
||||
|
||||
private boolean empty = false;
|
||||
|
||||
public SWFSourceInfo(String fileTitle) {
|
||||
this(null, null, fileTitle, false);
|
||||
empty = true;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return empty;
|
||||
}
|
||||
|
||||
public SWFSourceInfo(InputStream inputStream, String file, String fileTitle) {
|
||||
this(inputStream, file, fileTitle, true);
|
||||
}
|
||||
|
||||
@@ -1359,7 +1359,12 @@ public class Main {
|
||||
Helper.freeMem();
|
||||
showModeFrame();
|
||||
return true;
|
||||
} else {
|
||||
} else {
|
||||
for (int i = sourceInfos.size() - 1; i >= 0; i--) {
|
||||
if (sourceInfos.get(i).isEmpty()) {
|
||||
sourceInfos.remove(i);
|
||||
}
|
||||
}
|
||||
SWFSourceInfo[] sourceInfosCopy = new SWFSourceInfo[sourceInfos.size()];
|
||||
sourceInfos.toArray(sourceInfosCopy);
|
||||
sourceInfos.clear();
|
||||
@@ -1478,7 +1483,7 @@ public class Main {
|
||||
}
|
||||
String ext = newFileDialog.isGfx() ? "gfx" : "swf";
|
||||
String fileTitle = AppStrings.translate("new.filename") + "." + ext;
|
||||
SWFSourceInfo sourceInfo = new SWFSourceInfo(new ByteArrayInputStream(new byte[0]), null, fileTitle);
|
||||
SWFSourceInfo sourceInfo = new SWFSourceInfo(fileTitle);
|
||||
sourceInfos.add(sourceInfo);
|
||||
SWFList list = new SWFList();
|
||||
list.sourceInfo = sourceInfo;
|
||||
|
||||
@@ -731,6 +731,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
boolean hasDebugger = hasAbc && DebuggerTools.hasDebugger(swf);
|
||||
MainPanel mainPanel = mainFrame.getPanel();
|
||||
boolean swfLoaded = mainPanel != null ? !mainPanel.getSwfs().isEmpty() : false;
|
||||
boolean swfIsNew = swfSelected && swf.swfList != null && swf.swfList.sourceInfo.isEmpty();
|
||||
|
||||
setMenuEnabled("_/open", !isWorking);
|
||||
setMenuEnabled("/file/open", !isWorking);
|
||||
@@ -743,7 +744,7 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
setMenuEnabled("/file/close", swfSelected && !isWorking);
|
||||
setMenuEnabled("_/closeAll", swfLoaded && !isWorking);
|
||||
setMenuEnabled("/file/closeAll", swfLoaded && !isWorking);
|
||||
setMenuEnabled("/file/reload", swfSelected && !isWorking);
|
||||
setMenuEnabled("/file/reload", swfSelected && !swfIsNew && !isWorking);
|
||||
|
||||
setMenuEnabled("/file/export", swfSelected);
|
||||
setMenuEnabled("_/exportAll", swfSelected && !isWorking);
|
||||
|
||||
Reference in New Issue
Block a user