use of org.fife.ui.rsyntaxtextarea.FileLocation in project lara-framework by specs-feup.
the class EditorConfigurer method loadFile.
public static boolean loadFile(SourceTextArea sourceTextArea, File inputFile) {
TextEditorPane textArea = sourceTextArea.getTextArea();
if (inputFile.isDirectory()) {
SpecsLogs.warn("Input file cannot be a directory: '" + SpecsIo.getCanonicalPath(inputFile) + "'\n");
return false;
}
FileLocation location = FileLocation.create(inputFile);
try {
textArea.load(location, null);
textArea.setEncoding(StandardCharsets.UTF_8.name());
textArea.getDocument().putProperty(DefaultEditorKit.EndOfLineStringProperty, System.lineSeparator());
setSyntaxEditingStyle(sourceTextArea, inputFile);
return true;
} catch (IOException e) {
SpecsLogs.warn("Error message:\n", e);
}
return false;
}
Aggregations