Index: trunk/src/org/modelica/mdt/editor/BasicTextEditorActionContributor.java
===================================================================
--- trunk/src/org/modelica/mdt/editor/BasicTextEditorActionContributor.java	(revision 6)
+++ trunk/src/org/modelica/mdt/editor/BasicTextEditorActionContributor.java	(revision 6)
@@ -0,0 +1,28 @@
+/*
+ * Created on Jan 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.modelica.mdt.editor;
+
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+/**
+ * @author Peter Bunus
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class BasicTextEditorActionContributor extends
+		EditorActionBarContributor {
+
+	/**
+	 * 
+	 */
+	public BasicTextEditorActionContributor() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+}
Index: trunk/src/org/modelica/mdt/editor/ModelicaEditor.java
===================================================================
--- trunk/src/org/modelica/mdt/editor/ModelicaEditor.java	(revision 6)
+++ trunk/src/org/modelica/mdt/editor/ModelicaEditor.java	(revision 6)
@@ -0,0 +1,24 @@
+/*
+ * Created on Jan 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.modelica.mdt.editor;
+
+import org.eclipse.ui.editors.text.TextEditor;
+
+/**
+ * @author Peter Bunus
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class ModelicaEditor extends TextEditor {
+
+	public ModelicaEditor()
+	{
+		super();
+		setSourceViewerConfiguration(new ModelicaSourceViewerConfig());
+	}
+}
Index: trunk/src/org/modelica/mdt/editor/ModelicaKeywordDetector.java
===================================================================
--- trunk/src/org/modelica/mdt/editor/ModelicaKeywordDetector.java	(revision 6)
+++ trunk/src/org/modelica/mdt/editor/ModelicaKeywordDetector.java	(revision 6)
@@ -0,0 +1,70 @@
+/*
+ * Created on Jan 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.modelica.mdt.editor;
+
+import org.eclipse.jface.text.rules.IWordDetector;
+
+/**
+ * @author Peter Bunus
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+
+/**
+ * Determines whether a given character is valid as part of an Modelica keyword in
+ * the current context.
+ */
+
+public class ModelicaKeywordDetector implements IWordDetector, ModelicaSyntax {
+
+	/**
+	 * 
+	 */
+	public ModelicaKeywordDetector() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	   * @see org.eclipse.jface.text.rules.IWordDetector#isWordStart(char)
+	   */
+	  public boolean isWordStart(char c) {
+	    for (int i = 0; i < reservedwords.length; i++)
+	      if (((String) reservedwords[i]).charAt(0) == c)
+	        return true;
+
+	    for (int i = 0; i < types.length; i++)
+	      if (((String) types[i]).charAt(0) == c)
+	        return true;
+
+	    for (int i = 0; i < constants.length; i++)
+	      if (((String) constants[i]).charAt(0) == c)
+	        return true;
+	    return false;
+	  }
+
+	  /**
+	   * @see org.eclipse.jface.text.rules.IWordDetector#isWordPart(char)
+	   */
+	  public boolean isWordPart(char c) {
+	    for (int i = 0; i < reservedwords.length; i++)
+	      if (((String) reservedwords[i]).indexOf(c) != -1)
+	        return true;
+
+	    for (int i = 0; i < types.length; i++)
+	      if (((String) types[i]).indexOf(c) != -1)
+	        return true;
+
+	    for (int i = 0; i < constants.length; i++)
+	      if (((String) constants[i]).indexOf(c) != -1)
+	        return true;
+
+	    return false;
+	  }
+
+}
Index: trunk/src/org/modelica/mdt/editor/ModelicaRuleScanner.java
===================================================================
--- trunk/src/org/modelica/mdt/editor/ModelicaRuleScanner.java	(revision 6)
+++ trunk/src/org/modelica/mdt/editor/ModelicaRuleScanner.java	(revision 6)
@@ -0,0 +1,71 @@
+/*
+ * Created on Jan 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.modelica.mdt.editor;
+
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.rules.EndOfLineRule;
+import org.eclipse.jface.text.rules.IRule;
+import org.eclipse.jface.text.rules.IToken;
+import org.eclipse.jface.text.rules.RuleBasedScanner;
+import org.eclipse.jface.text.rules.SingleLineRule;
+import org.eclipse.jface.text.rules.MultiLineRule;
+import org.eclipse.jface.text.rules.WordRule;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+import java.lang.String;
+
+/**
+ * @author Peter Bunus
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class ModelicaRuleScanner extends RuleBasedScanner
+								 implements ModelicaSyntax {
+
+	//comments are shown in green 4 (0,139,0)
+	private static Color COMMENT_COLOR = new Color(Display.getCurrent(), new RGB(0, 139, 0));
+	//Modelica reserved keywords are shown in red4 (139,0,0)
+	private static Color KEYWORD_COLOR = new Color(Display.getCurrent(), new RGB(139, 0, 0));
+	//Modelica types  are shown in blue4 (0,0,139)
+	private static Color TYPES_COLOR = new Color(Display.getCurrent(), new RGB(0, 0, 139));
+
+	public ModelicaRuleScanner() {
+		
+		IToken commentToken = new Token(new TextAttribute(COMMENT_COLOR,null,SWT.BOLD));
+		IToken keywordToken = new Token(new TextAttribute(KEYWORD_COLOR,null,SWT.BOLD));
+		IToken typesToken   = new Token(new TextAttribute(TYPES_COLOR,null,SWT.BOLD));
+			
+		IRule[] rules = new IRule[4];
+			
+	    		
+		// Add word rule for keywords, types, and constants.
+		WordRule wordRule = new WordRule(new ModelicaKeywordDetector());
+		for (int i = 0; i < reservedwords.length; i++)
+		      wordRule.addWord(reservedwords[i], keywordToken);
+		for (int i = 0; i < types.length; i++)
+		      wordRule.addWord(types[i], typesToken);
+		for (int i = 0; i < constants.length; i++)
+		      wordRule.addWord(constants[i], keywordToken);
+		rules[0]=wordRule;
+		
+//		 this will match single line Modelica comments given between quotes "this is a comment"
+		String begging = "this if \\u0022" ;
+		System.out.println(begging);
+		rules[1] = (new SingleLineRule( "\"", "\"", commentToken,'\\'));
+		// this will match sinle line Modelica comments precceded by double backslash
+		rules[2] = (new EndOfLineRule("//", commentToken,'\\'));
+		//Add rules for multi-line comments
+		rules[3] = (new MultiLineRule("/*", "*/", commentToken, (char) 0, true)); 
+		
+		setRules(rules);
+	}
+
+}
Index: trunk/src/org/modelica/mdt/editor/ModelicaSourceViewerConfig.java
===================================================================
--- trunk/src/org/modelica/mdt/editor/ModelicaSourceViewerConfig.java	(revision 6)
+++ trunk/src/org/modelica/mdt/editor/ModelicaSourceViewerConfig.java	(revision 6)
@@ -0,0 +1,59 @@
+/*
+ * Created on Jan 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.modelica.mdt.editor;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author Peter Bunus
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class ModelicaSourceViewerConfig extends SourceViewerConfiguration {
+
+	private ModelicaRuleScanner scanner;
+	// default tag color is black
+	private static Color DEFAULT_TAG_COLOR= new Color(Display.getCurrent(), new RGB(0, 0, 0));
+
+	public ModelicaSourceViewerConfig() {
+
+	}
+
+	protected ModelicaRuleScanner getTagScanner() {
+		if (scanner == null) {
+			scanner = new ModelicaRuleScanner();
+			scanner.setDefaultReturnToken(
+				new Token(
+					new TextAttribute(
+			DEFAULT_TAG_COLOR)));
+		}
+		return scanner;
+	}
+
+	/**
+	 * Define reconciler for MyEditor
+	 */
+	public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+		PresentationReconciler reconciler = new PresentationReconciler();
+		DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getTagScanner());
+		reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+		reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+		return reconciler;
+	}
+
+}
Index: trunk/src/org/modelica/mdt/editor/ModelicaSyntax.java
===================================================================
--- trunk/src/org/modelica/mdt/editor/ModelicaSyntax.java	(revision 6)
+++ trunk/src/org/modelica/mdt/editor/ModelicaSyntax.java	(revision 6)
@@ -0,0 +1,91 @@
+/*
+ * Created on Jan 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.modelica.mdt.editor;
+
+/**
+ * @author Peter Bunus
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public interface ModelicaSyntax {
+	public static final String[] reservedwords = {"algorithm", "and",
+			"annotation", "block", "boundary", "Code", "class", "connect",
+			"connector", "constant", "discrete", "each", "else", "elseif",
+			"elsewhen", "end", "enumeration", "equation", "encapsulated",
+			"extends", "external", "false", "final", "flow", "for", "function",
+			"if", "import", "in", "initial", "inner", "input", "loop", "model",
+			"not", "outer", "overload", "or", "output", "package", "parameter",
+			"partial", "protected", "public", "record", "redeclare", "replaceable",
+			"results", "start", "then", "true", "type", "unsigned_real", "when", "while", "within"};
+
+		  public static final String[] predicates = {"UNION", "IS",
+		      "IS NULL", "NOT NULL", "IS OF", "IN", "BETWEEN",
+		      "OVERLAPS", "LIKE", "< >", "=", "<", ">", "<=", ">=",
+		      "NOT", "AND", "OR", "+", "-", "%", "|", ":",
+		      ".", "[ ]", "::", "SOME", "ANY", "ALL", "EXISTS", "union",
+		      "is", "is null", "not null", "is of", "in", "between",
+		      "overlaps", "like", "not", "and", "or", "some", "any",
+		      "all", "exists"};
+		  public static final String[] types = {"Real", "Integer", "Boolean"};
+		  public static final String[] constants = {"FALSE", "NULL",
+		      "TRUE", "false", "true", "null"};
+		  public static final String[] functions = {"ABS", "ABSVAL",
+		      "ACOS", "ASCII", "ASIN", "ATAN", "ATAN2", "BIGINT",
+		      "BLOB", "CEILING", "CHAR", "CHR", "CLOB", "COALESCE",
+		      "CONCAT", "CORRELATION", "COS", "COT", "COUNT",
+		      "COUNT_BIG", "COVARIANCE", "DATE", "DAY", "DAYNAME",
+		      "DAYOFWEEK", "DAYOFWEEK_ISO", "DAYOFYEAR", "DAYS",
+		      "DBCLOB", "DECIMAL", "DEGREES", "DEREF", "DIFFERENCE",
+		      "DIGITS", "DLCOMMENT", "DLLINKTYPE", "DLURLCOMPLETE",
+		      "DLURLPATH", "DLURLPATHONLY", "DLURLSCHEME",
+		      "DLURLSERVER", "DLVALUE", "DOUBLE", "EVENT_MON_STATE",
+		      "EXP", "FLOAT", "FLOOR", "GENERATE_UNIQUE", "GRAPHIC",
+		      "GROUPING", "HEX", "HOUR", "INSERT", "INTEGER",
+		      "JULIAN_DAY", "LCASE", "LCASE", "LEFT", "LENGTH", "LN",
+		      "LOCATE", "LOG", "LOG10", "LONG_VARCHAR",
+		      "LONG_VARGRAPHIC", "LTRIM", "LTRIM", "MAX", "MICROSECOND",
+		      "MIDNIGHT_SECONDS", "MIN", "MINUTE", "MOD", "MONTH",
+		      "MONTHNAME", "NODENUMBER", "NULLIF", "PARTITION",
+		      "POSSTR", "POWER", "QUARTER", "RADIANS", "RAISE_ERROR",
+		      "RAND", "REAL", "REPEAT", "REPLACE", "RIGHT", "ROUND",
+		      "RTRIM", "RTRIM", "SECOND", "SIGN", "SIN", "SMALLINT",
+		      "SOUNDEX", "SPACE", "SQLCACHE_SNAPSHOT", "SQRT", "STDDEV",
+		      "SUBSTR", "SUM", "TABLE_NAME", "TABLE_SCHEMA", "TAN",
+		      "TIME", "TIMESTAMP", "TIMESTAMP_ISO", "TIMESTAMPDIFF",
+		      "TRANSLATE", "TRUNCATE", "TRUNC", "TYPE_ID", "TYPE_NAME",
+		      "TYPE_SCHEMA", "UCASE", "UPPER", "VALUE", "VARCHAR",
+		      "VARGRAPHIC", "VARIANCE", "WEEK", "WEEK_ISO", "YEAR",
+		      "abs", "absval", "acos", "ascii", "asin", "atan", "atan2",
+		      "bigint", "blob", "ceiling", "char", "chr", "clob",
+		      "coalesce", "concat", "correlation", "cos", "cot",
+		      "count", "count_big", "covariance", "date", "day",
+		      "dayname", "dayofweek", "dayofweek_iso", "dayofyear",
+		      "days", "dbclob", "decimal", "degrees", "deref",
+		      "difference", "digits", "dlcomment", "dllinktype",
+		      "dlurlcomplete", "dlurlpath", "dlurlpathonly",
+		      "dlurlscheme", "dlurlserver", "dlvalue", "double",
+		      "event_mon_state", "exp", "float", "floor",
+		      "generate_unique", "graphic", "grouping", "hex", "hour",
+		      "insert", "integer", "julian_day", "lcase", "lcase",
+		      "left", "length", "ln", "locate", "log", "log10",
+		      "long_varchar", "long_vargraphic", "ltrim", "ltrim",
+		      "max", "microsecond", "midnight_seconds", "min", "minute",
+		      "mod", "month", "monthname", "nodenumber", "nullif",
+		      "partition", "posstr", "power", "quarter", "radians",
+		      "raise_error", "rand", "real", "repeat", "replace",
+		      "right", "round", "rtrim", "rtrim", "second", "sign",
+		      "sin", "smallint", "soundex", "space",
+		      "sqlcache_snapshot", "sqrt", "stddev", "substr", "sum",
+		      "table_name", "table_schema", "tan", "time", "timestamp",
+		      "timestamp_iso", "timestampdiff", "translate", "truncate",
+		      "trunc", "type_id", "type_name", "type_schema", "ucase",
+		      "upper", "value", "varchar", "vargraphic", "variance",
+		      "week", "week_iso", "year"};
+		  Object[] allWords = {reservedwords, predicates, types,
+		      constants, functions};
+}
