View Javadoc
1   /*
2    WSMO Studio - a Semantic Web Service Editor
3    Copyright (c) 2004-2006, OntoText Lab. / SIRMA Group
4    
5    This library is free software; you can redistribute it and/or modify it under
6    the terms of the GNU Lesser General Public License as published by the Free
7    Software Foundation; either version 2.1 of the License, or (at your option)
8    any later version.
9    This library is distributed in the hope that it will be useful, but WITHOUT
10   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   details.
13   You should have received a copy of the GNU Lesser General Public License along
14   with this library; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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   * $Log: WSMOTextEditor.java,v $
85   * Revision 1.7  2006/01/26 11:56:11  alex_simov
86   * text style is now fully user adjustable for all elements
87   *
88   * Revision 1.6  2006/01/09 12:51:14  alex_simov
89   * Copyright message in header updated
90   *
91   * Revision 1.5  2005/10/31 12:53:03  alex_simov
92   * Ctrl+S (Save) shortcut enabled
93   *
94   * Revision 1.4  2005/07/29 15:08:03  alex_simov
95   * added javadoc: class description, footer
96   *
97   *
98   */