/** * Loads a content from a file. * * @param file File path to load. * @throws java.io.FileNotFoundException thrown if file could not be found. * @throws java.io.IOException thrown if file could no be read. */ public void openFile(File file) throws FileNotFoundException, IOException { mFilePath = file; setText(FileUtils.readFileToString(file)); setMode(Modes.getModeFromFile(file.getName())); // getUndoManager().reset(); undoButton.setDisable(true); redoButton.setDisable(true); }
/** * Change or set new save location and saves the file. * * @param file new location to save. * @throws java.io.IOException thrown if file could no be read. */ public void saveAs(File file) throws IOException, NullPointerException { mFilePath = file; saveFile(); setMode(Modes.getModeFromFile(file.getName())); }