Search in sources :

Example 1 with FileLocation

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;
}
Also used : FileLocation(org.fife.ui.rsyntaxtextarea.FileLocation) TextEditorPane(org.fife.ui.rsyntaxtextarea.TextEditorPane) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 FileLocation (org.fife.ui.rsyntaxtextarea.FileLocation)1 TextEditorPane (org.fife.ui.rsyntaxtextarea.TextEditorPane)1