mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-15 12:21:59 +00:00
Added #1845 Show warning on opening file in Read only mode (binary search, unknown extensions, etc.)
Added #1845 Show error message on saving in Read only mode, "Save As" must be used
This commit is contained in:
@@ -140,6 +140,8 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainFrameMenu.class.getName()).log(Level.SEVERE, "Cannot save SWF", ex);
|
||||
}
|
||||
} else {
|
||||
ViewMessages.showMessageDialog(mainFrame.getWindow(), translate("error.readonly.cannotSave"), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
Main.stopSaving(savedFile);
|
||||
} else if (swf.binaryData != null) {
|
||||
@@ -184,8 +186,10 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
|
||||
if (swf != null) {
|
||||
if (saveAs(swf, SaveFileMode.SAVEAS)) {
|
||||
if (swf.swfList != null) { //binarydata won't clear modified on saveas
|
||||
swf.clearModified();
|
||||
if (swf.swfList != null) { //binarydata won't clear modified on saveas
|
||||
if (!isSwfReadOnly(swf)) {
|
||||
swf.clearModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +199,10 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isSwfReadOnly(SWF swf) {
|
||||
return swf.swfList != null && swf.swfList.bundle != null && swf.swfList.bundle.isReadOnly();
|
||||
}
|
||||
|
||||
private boolean saveAs(SWF swf, SaveFileMode mode) {
|
||||
View.checkAccess();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user