public void saveDoc() {
Path currentPath = current.currentPath();
if (currentPath == null) {
FileChooser chooser = new FileChooser();
chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("Asciidoc","*.asc", "*.asciidoc", "*.adoc", "*.ad", "*.txt"));
File file = chooser.showSaveDialog(null);
if (file == null)
return;
IOHelper.writeToFile(file, (String) current.currentEngine().executeScript("editor.getValue();"), TRUNCATE_EXISTING, CREATE);
current.putTab(current.getCurrentTab(), file.toPath(), current.currentView());
current.setCurrentTabText(file.toPath().getFileName().toString());