FileObject f = ... DataObject data = DataObject.find(f); EditorCookie cookie = data.getLookup().lookup(EditorCookie.class); cookie.saveDocument();
public boolean save() throws IOException { if (editorCookie == null) { return false; } if (editorCookie.isModified()) { editorCookie.saveDocument(); return true; } return false; }
public void saveDocument() throws java.io.IOException { currentEditorCookie().saveDocument(); }
/** * Saves file. * * @param fo - file object */ private static void saveFileAndMarkAsReadOnly(FileObject fo) { try { DataObject dob = DataObject.find(fo); EditorCookie ec = dob.getLookup().lookup(EditorCookie.class); ec.saveDocument(); ReadOnlySupport ro = dob.getLookup().lookup(ReadOnlySupport.class); if (ro != null) { ro.setReadOnly(true); } } catch (DataObjectNotFoundException e) { //do nothing, memory file already deleted } catch (FileStateInvalidException e) { //do nothing, memory file already deleted } catch (IOException ex) { Exceptions.printStackTrace(ex); } }
/** * Force the editor to save the given filename. */ public static boolean saveFile(String fileName, NativeDebugger debugger) { FileObject fo = findFileObject(fileName, debugger); DataObject dao = dataObjectFor(fo); if (dao == null) return false; EditorCookie ec = dao.getCookie(EditorCookie.class); if (ec == null) return false; try { ec.saveDocument(); } catch (java.io.IOException ex) { return false; } return true; }
} finally { reformat.unlock(); ec.saveDocument();
} finally { reformat.unlock(); ec.saveDocument();
Exceptions.printStackTrace(ex); } finally { ec.saveDocument();
ec.saveDocument(); } catch (UserQuestionException uqe) { uqe.confirmed();
DataObject.find(fo).getLookup().lookup(EditorCookie.class).saveDocument(); } catch (IOException e) { Util.err.notify(ErrorManager.INFORMATIONAL, e);