Save all code in the current sketch. This just forces the files to save in place, so if it's an untitled (un-saved) sketch, saveAs() should be called instead. (This is handled inside Editor.handleSave()).
()
| 802 | * called instead. (This is handled inside Editor.handleSave()). |
| 803 | */ |
| 804 | public boolean save() throws IOException { |
| 805 | // make sure the user didn't hide the sketch folder |
| 806 | ensureExistence(); |
| 807 | |
| 808 | // first get the contents of the editor text area |
| 809 | updateSketchCodes(); |
| 810 | |
| 811 | // don't do anything if not actually modified |
| 812 | //if (!modified) return false; |
| 813 | |
| 814 | if (isReadOnly()) { |
| 815 | // if the files are read-only, need to first do a "save as". |
| 816 | Messages.showMessage(Language.text("save_file.messages.is_read_only"), |
| 817 | Language.text("save_file.messages.is_read_only.description")); |
| 818 | // if the user cancels, give up on the save() |
| 819 | if (!saveAs()) return false; |
| 820 | } |
| 821 | |
| 822 | for (SketchCode sc : code) { |
| 823 | if (sc.isModified()) { |
| 824 | sc.save(); |
| 825 | } |
| 826 | } |
| 827 | calcModified(); |
| 828 | return true; |
| 829 | } |
| 830 | |
| 831 | |
| 832 | /** |
no test coverage detected