MCPcopy Create free account
hub / github.com/BaseXdb/basex / save

Method save

basex-core/src/main/java/org/basex/gui/view/text/TextView.java:226–250  ·  view source on GitHub ↗

Saves the displayed text.

()

Source from the content-addressed store, hash-verified

224 * Saves the displayed text.
225 */
226 private void save() {
227 final BaseXFileChooser fc = new BaseXFileChooser(gui,
228 SAVE_AS, gui.gopts.get(GUIOptions.WORKPATH)).suffix(IO.XMLSUFFIX);
229
230 final IOFile file = fc.select(Mode.FSAVE);
231 if(file == null) return;
232 gui.gopts.setFile(GUIOptions.WORKPATH, file.parent());
233
234 gui.cursor(CURSORWAIT, true);
235 try(PrintOutput out = new PrintOutput(file)) {
236 final Context context = gui.context;
237 if(cachedCmd != null) {
238 cachedCmd.execute(context, out);
239 } else if(cachedNodes != null) {
240 cachedNodes.serialize(Serializer.get(out, context.options.get(MainOptions.SERIALIZER)));
241 } else {
242 out.write(text.getText());
243 }
244 } catch(final IOException ex) {
245 Util.debug(ex);
246 BaseXDialog.error(gui, Util.info(FILE_NOT_SAVED_X, file));
247 } finally {
248 gui.cursor(CURSORARROW, true);
249 }
250 }
251}

Callers 1

TextViewMethod · 0.95

Calls 14

selectMethod · 0.95
parentMethod · 0.95
getMethod · 0.95
debugMethod · 0.95
errorMethod · 0.95
infoMethod · 0.95
setFileMethod · 0.80
getMethod · 0.65
executeMethod · 0.65
suffixMethod · 0.45
cursorMethod · 0.45
serializeMethod · 0.45

Tested by

no test coverage detected