1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 /***
19 * <p>Title: WSMO Studio</p>
20 * <p>Description: Semantic Web Service Editor</p>
21 * <p>Copyright: Copyright (c) 2004-2006</p>
22 * <p>Company: OntoText Lab. / SIRMA </p>
23 */
24
25 package org.wsmostudio.ui.editors.text;
26
27 import org.eclipse.swt.SWT;
28 import org.eclipse.swt.graphics.RGB;
29 import org.eclipse.ui.actions.ActionFactory;
30 import org.eclipse.ui.editors.text.TextEditor;
31
32 /***
33 * A plain text editor capable to show syntax highlighting.
34 * Different sets of keywords can be colorized in different way.
35 * Each word set is contained in a separate file where each word
36 * appears on a new line. Currently, there are three word sets
37 * supported, located in files: <code>dict/keywords.list</code>,
38 * <code>dict/system.list</code> and <code>dict/auxwords.list</code>.
39 *
40 * @author not attributable
41 * @version $Revision: 1.7 $ $Date: 2006/01/26 11:56:11 $
42 */
43
44 public class WSMOTextEditor extends TextEditor {
45
46 public static RGB KEY_COLOR = new RGB(81, 102, 120);
47 public static RGB AUX_COLOR = new RGB(0, 106, 106);
48 public static RGB COMMENT_COLOR = new RGB(63, 127, 95);
49 public static RGB STRING_COLOR = new RGB(27, 0, 255);
50 public static RGB SYSTEM_COLOR = new RGB(167, 0, 85);
51 public static RGB DEFAULT_COLOR = new RGB(0, 0, 0);
52
53 public static final int KEY_STYLE = SWT.ITALIC;
54 public static final int AUX_STYLE = SWT.NONE;
55 public static final int COMMENT_STYLE = SWT.NONE;
56 public static final int STRING_STYLE = SWT.NONE;
57 public static final int SYSTEM_STYLE = SWT.BOLD;
58 public static final int DEFAULT_STYLE = SWT.NONE;
59
60 public static final String KEYWORDS_FILE = "dict/keywords.list";
61 public static final String SYSTEM_FILE = "dict/system.list";
62 public static final String AUX_WORDS_FILE = "dict/auxwords.list";
63
64 public WSMOTextEditor()
65 {
66 super();
67 setSourceViewerConfiguration(new WSMOSourceViewerConfig());
68 }
69
70 protected void createActions() {
71 super.createActions();
72 ActionFactory.IWorkbenchAction saveAction = ActionFactory.SAVE.create(
73 this.getSite().getWorkbenchWindow());
74 setAction(saveAction.getId(), saveAction);
75 }
76
77 public void doUpdateView() {
78 ((WSMOSourceViewerConfig)getSourceViewerConfiguration()).getTagScanner().updateColors();
79 this.getSourceViewer().invalidateTextPresentation();
80 }
81 }
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98