com.bbn.swede.editor
Class OWLColorProvider

java.lang.Object
  extended bycom.bbn.swede.editor.OWLColorProvider

public class OWLColorProvider
extends Object

Maps content types to text colors for syntax highlighting in the OWL source editor.

Author:
jlerner

Field Summary
protected static OWLColorProvider _provider
          The singleton instance.
static String ATTRIBUTE_VALUE
          Content type string for attribute values.
static String CDATA
          Content type string for literal content.
static String COMMENT
          Content type strying for XML comments.
static String DOCTYPE
          Content type string for XML DOCTYPE.
static String GENERIC_ATTRIBUTE
          Content type string for generic attributes.
static String GENERIC_TAG
          Content type string for generic tags.
static String LANG
          Content type string for language tags and attributes.
static String PROCESSING_INSTRUCTION
          Content type string for XML processing instructions.
static String XML_ATTRIBUTE
          Content type string for XML attributes.
 
Constructor Summary
protected OWLColorProvider()
          Creates an OWL color provider.
 
Method Summary
 TextAttribute createTextAttribute(String sType)
          Creates a org.eclipse.jface.text.TextAttribute to define the text style for a content type.
 TextAttribute createTextAttribute(String sType, int style)
          Creates a org.eclipse.jface.text.TextAttribute to define the text style for a content type.
 Color getBackground(Object element)
           
static OWLColorProvider getColorProvider()
          Returns the one and only instance of OWLColorProvider.
 Color getForeground(Object element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_provider

protected static OWLColorProvider _provider
The singleton instance.


ATTRIBUTE_VALUE

public static final String ATTRIBUTE_VALUE
Content type string for attribute values. The attribute value is everything between the single or double quotes, inclusive.

See Also:
Constant Field Values

LANG

public static final String LANG
Content type string for language tags and attributes. A language element is anything from the owl, rdf, or rdfs namespace.

See Also:
Constant Field Values

GENERIC_ATTRIBUTE

public static final String GENERIC_ATTRIBUTE
Content type string for generic attributes. A generic attribute is anything used as an attribute from a namespace besides owl, rdf, or rdfs.

See Also:
Constant Field Values

GENERIC_TAG

public static final String GENERIC_TAG
Content type string for generic tags. A generic tag is anything used as a tag from a namespace besides owl, rdf, or rdfs.

See Also:
Constant Field Values

COMMENT

public static final String COMMENT
Content type strying for XML comments.

See Also:
Constant Field Values

PROCESSING_INSTRUCTION

public static final String PROCESSING_INSTRUCTION
Content type string for XML processing instructions. For syntax highlihgting purposes, the XML version line is treated as a PI.

See Also:
Constant Field Values

DOCTYPE

public static final String DOCTYPE
Content type string for XML DOCTYPE.

See Also:
Constant Field Values

XML_ATTRIBUTE

public static final String XML_ATTRIBUTE
Content type string for XML attributes. This includes xml:base and namespace declarations.

See Also:
Constant Field Values

CDATA

public static final String CDATA
Content type string for literal content.

See Also:
Constant Field Values
Constructor Detail

OWLColorProvider

protected OWLColorProvider()
Creates an OWL color provider.

Method Detail

getColorProvider

public static OWLColorProvider getColorProvider()
Returns the one and only instance of OWLColorProvider.

Returns:
The singleton instance

getForeground

public Color getForeground(Object element)

getBackground

public Color getBackground(Object element)

createTextAttribute

public TextAttribute createTextAttribute(String sType)
Creates a org.eclipse.jface.text.TextAttribute to define the text style for a content type. The TextAttribute returned by this method will use a regular font weight. This is a convenience method, fully equivalent to createTextAttribute(sType,STW.NONE)

Parameters:
sType - The content type of the text that needs to be styled
Returns:
A org.eclipse.jface.text.TextAttribute with the proper text color and a regular font weight

createTextAttribute

public TextAttribute createTextAttribute(String sType,
                                         int style)
Creates a org.eclipse.jface.text.TextAttribute to define the text style for a content type.

Parameters:
sType - The content type of the text that needs to be styled
style - An SWT style constant indicating the desired font weight
Returns:
A org.eclipse.jface.text.TextAttribute with the proper text color and the requested font weight


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.