prevent Export with examples and untitled/unsaved sketches

This commit is contained in:
Ben Fry
2015-08-08 10:56:37 -04:00
parent c1843c1f05
commit 4abfd9bdaa
3 changed files with 19 additions and 2 deletions

View File

@@ -217,6 +217,10 @@ export.full_screen = Full Screen
export.embed_java = Embed Java
export.embed_java.for = Embed Java for
export.code_signing = Code Signing
export.messages.is_read_only = Sketch is Read-Only
export.messages.is_read_only.description = Some files are marked "read-only", so you will\nneed to re-save the sketch in another location,\nand try again.
export.messages.cannot_export = Cannot Export
export.messages.cannot_export.description = You cannot export a sketch that has not been saved.
# Find (Frame)
find = Find

View File

@@ -1096,6 +1096,20 @@ public class JavaEditor extends Editor {
* <A HREF="http://dev.processing.org/bugs/show_bug.cgi?id=157">Bug 157</A>
*/
protected boolean handleExportCheckModified() {
if (sketch.isReadOnly()) {
// if the files are read-only, need to first do a "save as".
Base.showMessage(Language.text("export.messages.is_read_only"),
Language.text("export.messages.is_read_only.description"));
return false;
}
// don't allow if untitled
if (sketch.isUntitled()) {
Base.showMessage(Language.text("export.messages.cannot_export"),
Language.text("export.messages.cannot_export.description"));
return false;
}
if (sketch.isModified()) {
Object[] options = { Language.text("prompt.ok"), Language.text("prompt.cancel") };
int result = JOptionPane.showOptionDialog(this,

View File

@@ -5,8 +5,7 @@ X create sketchbook subfolders on startup
X https://github.com/processing/processing/issues/3548
X save export settings to preferences
X disable Export button when no platforms selected
_ export allowed with untitled sketches
_ also with examples?
X prevent Export with examples and untitled/unsaved sketches
earlier/cleaning