mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 00:08:51 -05:00
Enable new format expression token maker and syntax highlighting
This commit is contained in:
parent
a76f8a5753
commit
aeb630d76a
@ -57,7 +57,7 @@ import javax.swing.event.PopupMenuListener;
|
|||||||
|
|
||||||
import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
|
import org.fife.ui.rsyntaxtextarea.RSyntaxDocument;
|
||||||
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
|
||||||
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
|
import org.fife.ui.rsyntaxtextarea.Theme;
|
||||||
import org.fife.ui.rtextarea.RTextScrollPane;
|
import org.fife.ui.rtextarea.RTextScrollPane;
|
||||||
|
|
||||||
import net.filebot.ResourceManager;
|
import net.filebot.ResourceManager;
|
||||||
@ -359,22 +359,30 @@ public class FormatDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private RSyntaxTextArea createEditor() {
|
private RSyntaxTextArea createEditor() {
|
||||||
RSyntaxTextArea editor = new RSyntaxTextArea(new RSyntaxDocument(SyntaxConstants.SYNTAX_STYLE_GROOVY), "", 1, 80);
|
RSyntaxDocument document = new RSyntaxDocument(new FormatExpressionTokenMakerFactory(), FormatExpressionTokenMakerFactory.SYNTAX_STYLE_GROOVY_FORMAT_EXPRESSION);
|
||||||
|
RSyntaxTextArea editor = new RSyntaxTextArea(document, "", 1, 80);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Theme.load(FormatDialog.class.getResourceAsStream("FormatExpression.RSyntaxTheme.xml")).apply(editor);
|
||||||
|
} catch (Exception e) {
|
||||||
|
debug.log(Level.WARNING, e, e::toString);
|
||||||
|
}
|
||||||
|
|
||||||
editor.setAntiAliasingEnabled(true);
|
editor.setAntiAliasingEnabled(true);
|
||||||
editor.setAnimateBracketMatching(false);
|
editor.setAnimateBracketMatching(true);
|
||||||
editor.setAutoIndentEnabled(false);
|
editor.setAutoIndentEnabled(true);
|
||||||
editor.setClearWhitespaceLinesEnabled(false);
|
|
||||||
editor.setBracketMatchingEnabled(true);
|
editor.setBracketMatchingEnabled(true);
|
||||||
editor.setCloseCurlyBraces(false);
|
editor.setCloseCurlyBraces(true);
|
||||||
editor.setCodeFoldingEnabled(false);
|
editor.setCodeFoldingEnabled(false);
|
||||||
editor.setHyperlinksEnabled(false);
|
editor.setHyperlinksEnabled(false);
|
||||||
editor.setUseFocusableTips(false);
|
editor.setUseFocusableTips(false);
|
||||||
|
editor.setClearWhitespaceLinesEnabled(false);
|
||||||
editor.setHighlightCurrentLine(false);
|
editor.setHighlightCurrentLine(false);
|
||||||
|
editor.setHighlightSecondaryLanguages(false);
|
||||||
editor.setLineWrap(false);
|
editor.setLineWrap(false);
|
||||||
|
editor.setMarkOccurrences(false);
|
||||||
editor.setPaintMarkOccurrencesBorder(false);
|
editor.setPaintMarkOccurrencesBorder(false);
|
||||||
editor.setPaintTabLines(false);
|
editor.setPaintTabLines(false);
|
||||||
editor.setMarkOccurrences(false);
|
|
||||||
editor.setFont(new Font(MONOSPACED, PLAIN, 14));
|
editor.setFont(new Font(MONOSPACED, PLAIN, 14));
|
||||||
|
|
||||||
// update format on change
|
// update format on change
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE RSyntaxTheme SYSTEM "theme.dtd">
|
||||||
|
|
||||||
|
<!-- FileBot Format Expression theme that blends Eclipse and IntelliJ IDEA. -->
|
||||||
|
<RSyntaxTheme version="1.0">
|
||||||
|
|
||||||
|
<!-- General editor colors. -->
|
||||||
|
<background color="ffffff" />
|
||||||
|
<caret color="000000" />
|
||||||
|
<selection fg="default" useFG="false" bg="c8c8ff" />
|
||||||
|
<currentLineHighlight color="ffffd7" fade="false" />
|
||||||
|
<marginLine fg="b0b4b9" />
|
||||||
|
<markAllHighlight color="ccccff" />
|
||||||
|
<markOccurrencesHighlight color="ccccff" border="false" />
|
||||||
|
<matchedBracket fg="99ccff" bg="99ccff" highlightBoth="true" animate="false" />
|
||||||
|
<hyperlinks fg="0000ff" />
|
||||||
|
<secondaryLanguages>
|
||||||
|
<language index="1" bg="eafaf1" />
|
||||||
|
</secondaryLanguages>
|
||||||
|
|
||||||
|
<!-- Gutter styling. -->
|
||||||
|
<gutterBorder color="dddddd" />
|
||||||
|
<lineNumbers fg="787878" />
|
||||||
|
<foldIndicator fg="808080" iconBg="ffffff" />
|
||||||
|
<iconRowHeader activeLineRange="3399ff" />
|
||||||
|
|
||||||
|
<!-- Syntax tokens. -->
|
||||||
|
<tokenStyles>
|
||||||
|
<style token="IDENTIFIER" fg="000000" />
|
||||||
|
<style token="RESERVED_WORD" fg="810ca8" bold="true" />
|
||||||
|
<style token="RESERVED_WORD_2" fg="810ca8" bold="true" />
|
||||||
|
<style token="ANNOTATION" fg="808000" />
|
||||||
|
<style token="COMMENT_DOCUMENTATION" fg="808080" italic="true" />
|
||||||
|
<style token="COMMENT_EOL" fg="808080" italic="true" />
|
||||||
|
<style token="COMMENT_MULTILINE" fg="808080" italic="true" />
|
||||||
|
<style token="COMMENT_KEYWORD" fg="808080" bold="true" italic="true" />
|
||||||
|
<style token="COMMENT_MARKUP" fg="808080" bg="e2ffe2" italic="true" />
|
||||||
|
<style token="DATA_TYPE" fg="810ca8" bold="true" />
|
||||||
|
<style token="FUNCTION" fg="810ca8" />
|
||||||
|
<style token="LITERAL_BOOLEAN" fg="810ca8" bold="true" />
|
||||||
|
<style token="LITERAL_NUMBER_DECIMAL_INT" fg="2900ff" />
|
||||||
|
<style token="LITERAL_NUMBER_FLOAT" fg="2900ff" />
|
||||||
|
<style token="LITERAL_NUMBER_HEXADECIMAL" fg="2900ff" />
|
||||||
|
<style token="LITERAL_STRING_DOUBLE_QUOTE" fg="cc6600" />
|
||||||
|
<style token="LITERAL_CHAR" fg="2900ff" />
|
||||||
|
<style token="LITERAL_BACKQUOTE" fg="2900ff" />
|
||||||
|
<style token="MARKUP_TAG_DELIMITER" fg="000000" />
|
||||||
|
<style token="MARKUP_TAG_NAME" fg="000080" />
|
||||||
|
<style token="MARKUP_TAG_ATTRIBUTE" fg="0000ff" />
|
||||||
|
<style token="MARKUP_TAG_ATTRIBUTE_VALUE" fg="008000" />
|
||||||
|
<style token="MARKUP_COMMENT" fg="808080" italic="true" />
|
||||||
|
<style token="MARKUP_DTD" fg="808080" />
|
||||||
|
<style token="MARKUP_PROCESSING_INSTRUCTION" fg="808080" />
|
||||||
|
<style token="MARKUP_CDATA" fg="cc6600" />
|
||||||
|
<style token="MARKUP_CDATA_DELIMITER" fg="008080" />
|
||||||
|
<style token="MARKUP_ENTITY_REFERENCE" fg="008000" />
|
||||||
|
<style token="OPERATOR" fg="000000" />
|
||||||
|
<style token="PREPROCESSOR" fg="808080" />
|
||||||
|
<style token="REGEX" fg="008040" />
|
||||||
|
<style token="SEPARATOR" fg="810ca8" />
|
||||||
|
<style token="VARIABLE" fg="810ca8" />
|
||||||
|
<style token="WHITESPACE" fg="000000" />
|
||||||
|
|
||||||
|
<style token="ERROR_IDENTIFIER" fg="ff0000" />
|
||||||
|
<style token="ERROR_NUMBER_FORMAT" fg="ff0000" />
|
||||||
|
<style token="ERROR_STRING_DOUBLE" fg="ff0000" />
|
||||||
|
<style token="ERROR_CHAR" fg="ff0000" />
|
||||||
|
</tokenStyles>
|
||||||
|
|
||||||
|
</RSyntaxTheme>
|
@ -1,4 +1,5 @@
|
|||||||
package net.filebot.ui.rename;
|
package net.filebot.ui.rename;
|
||||||
|
|
||||||
import static java.util.Collections.*;
|
import static java.util.Collections.*;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
Loading…
Reference in New Issue
Block a user