mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-11 18:51:53 +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:
@@ -839,6 +839,14 @@ public class Main {
|
||||
|
||||
Stopwatch sw = Stopwatch.startNew();
|
||||
if (bundle != null) {
|
||||
if (bundle.isReadOnly()) {
|
||||
View.execInEventDispatchLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ViewMessages.showMessageDialog(getMainFrame().getWindow(), AppStrings.translate("warning.readonly").replace("%file%", sourceInfo.getFileTitleOrName()), AppStrings.translate("message.warning"), JOptionPane.WARNING_MESSAGE, Configuration.warningOpeningReadOnly);
|
||||
}
|
||||
});
|
||||
}
|
||||
result.bundle = bundle;
|
||||
result.name = new File(sourceInfo.getFileTitleOrName()).getName();
|
||||
for (Entry<String, SeekableInputStream> streamEntry : bundle.getAll().entrySet()) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -564,3 +564,6 @@ config.description.lastView = Last displayed view mode
|
||||
|
||||
config.name.swfSpecificCustomConfigs = SWF specific custom configurations
|
||||
config.description.swfSpecificCustomConfigs = Contains the SWF specific configurations in custom format
|
||||
|
||||
config.name.warningOpeningReadOnly = Warn on opening readonly SWF
|
||||
config.description.warningOpeningReadOnly = Show warning when opening SWF from readonly source
|
||||
|
||||
@@ -875,4 +875,14 @@ message.input.addFrames.howmany = How many frames to add
|
||||
|
||||
contextmenu.addFramesBefore = Add frames before
|
||||
contextmenu.addFramesAfter = Add frames after
|
||||
contextmenu.addFrames = Add frames
|
||||
contextmenu.addFrames = Add frames
|
||||
|
||||
error.readonly.cannotSave = File will NOT be saved. This SWF file source does not allow to save changes.\r\n\
|
||||
This is usually caused by loading binary data file or file with unknown extension in binary mode.\r\n\
|
||||
Please use the "Save As" command to export particular SWF file.
|
||||
|
||||
warning.readonly = The file "%file%" is loaded in READONLY mode. \r\n\
|
||||
Changes you make won't be saved unless you use the "Save as" button.\r\n\
|
||||
This is usually caused by opening file in binary search mode,\r\n\
|
||||
the file has probably unknown extension and then saving cannot be done because\r\n\
|
||||
the file format is unknown.
|
||||
|
||||
@@ -851,4 +851,15 @@ message.input.addFrames.howmany = Kolik sn\u00edmk\u016f p\u0159idat
|
||||
|
||||
contextmenu.addFramesBefore = P\u0159idat sn\u00edmky p\u0159ed
|
||||
contextmenu.addFramesAfter = P\u0159idat sn\u00edmky po
|
||||
contextmenu.addFrames = P\u0159idat sn\u00edmky
|
||||
contextmenu.addFrames = P\u0159idat sn\u00edmky
|
||||
|
||||
|
||||
error.readonly.cannotSave = Soubor NEBUDE ulo\u017een. Zdroj tohoto SWF souboru nedovoluje ukl\u00e1dat zm\u011bny.\r\n\
|
||||
Toto je obvykle zp\u016fsobeno na\u010dten\u00edm bin\u00e1rn\u00edho datov\u00e9ho souboru nebo souboru s nezn\u00e1mou p\u0159\u00edponou v bin\u00e1rn\u00edm m\u00f3du.\r\n\
|
||||
Pros\u00edm pou\u017eijte p\u0159\u00edkaz "Ulo\u017eit jako" pro export jednotliv\u00fdch SWF soubor\u016f.
|
||||
|
||||
warning.readonly = Soubor "%file%" je na\u010dten\u00fd v re\u017eimu JEN KE \u010cTEN\u00cd. \r\n\
|
||||
Zm\u011bny kter\u00e9 provedete nebudou ulo\u017eeny dokud nepou\u017eijete tla\u010d\u00edtko "Ulo\u017eit jako".\r\n\
|
||||
Toto je obvykle zp\u016fsobeno otev\u00edr\u00e1n\u00edm souboru v re\u017eimu bin\u00e1rn\u00edho vyhled\u00e1v\u00e1n\u00ed,\r\n\
|
||||
soubor m\u00e1 pravd\u011bpodobn\u011b nezn\u00e1mou p\u0159\u00edponu a tak ulo\u017een\u00ed nen\u00ed mo\u017en\u00e9 proto\u017ee\r\n\
|
||||
form\u00e1t souboru nen\u00ed zn\u00e1m.
|
||||
Reference in New Issue
Block a user