01: package tide.editor;
02:
03: import snow.lookandfeel.ThemesManager;
04:
05: import snow.texteditor.*;
06: import javax.swing.text.*;
07: import javax.swing.undo.*;
08: import javax.swing.event.*;
09: import java.awt.*;
10: import java.util.*;
11:
12: /** Undoable document used to edit the java source files.
13: */
14: public final class EditorDocument extends UndoableDocument {
15: // used to highlight errors (definitions)
16: // public static final SimpleColorHighlighter errorHighlighter = new SimpleColorHighlighter( new Color(200, 130, 30, 50) );
17: // public static final SimpleColorHighlighter autoSelectHighlighter = new SimpleColorHighlighter( new Color(120, 120, 120, 50) );
18:
19: // when user clicks on the syntax tree
20: //public static SimpleColorHighlighter syntaxLocationHighlighter = new SimpleColorHighlighter( Color.magenta.brighter() );
21:
22: public EditorDocument() {
23: super ();
24: setOrUpdateStyles();
25: }
26:
27: /** should be called on UI manager changes
28: */
29: public void setOrUpdateStyles() {
30:
31: Style defaultStyle = this .getStyle("regular");
32: StyleConstants.setForeground(defaultStyle, ThemesManager
33: .getInstance().get_tideEditor_textColor()); // black
34:
35: Style keywordStyle = this .addStyle("keyword", defaultStyle);
36: StyleConstants.setForeground(keywordStyle, ThemesManager
37: .getInstance().get_tideEditor_keywordColor()); // new Color(160,30,30));
38:
39: Style commentStyle = this .addStyle("comment", defaultStyle);
40: StyleConstants.setForeground(commentStyle, ThemesManager
41: .getInstance().get_tideEditor_commentColor()); // blue (30,30,160)
42:
43: Style litteralStyle = this .addStyle("litteral", defaultStyle);
44: StyleConstants.setForeground(litteralStyle, ThemesManager
45: .getInstance().get_tideEditor_litteralColor()); // new Color(30,160,30));
46:
47: }
48:
49: public Style getCommentStyle() {
50: return this .getStyle("comment");
51: }
52:
53: public Style getKeywordStyle() {
54: return this .getStyle("keyword");
55: }
56:
57: public Style getLitteralStyle() {
58: return this .getStyle("litteral");
59: }
60:
61: public Style getDefaultStyle() {
62: return this .getStyle("default");
63: }
64:
65: }
|