com.bbn.swede.editor
Class EditorPlugin

java.lang.Object
  extended byAbstractUIPlugin
      extended bycom.bbn.swede.editor.EditorPlugin

public class EditorPlugin
extends AbstractUIPlugin

Plugin class for the com.bbn.swede.editor plugin. Contains convenience methods for working with editors.

Author:
jlerner
See Also:
Serialized Form

Field Summary
static String PREFERENCE_ATTRIBUTE_ALIGN
          Editor preference controlling whether attributes are aligned with the end of the tag's name.
static String PREFERENCE_ATTRIBUTE_ALIGN_VALUE
          Editor preference controlling whether the '=' is aligned for wrapped attributes.
static String PREFERENCE_ATTRIBUTE_DELIMITER
          Editor preference controlling use of single vs.
static String PREFERENCE_ATTRIBUTE_INDENT
          Editor preference controlling how wrapped attributes are indented.
static String PREFERENCE_ATTRIBUTE_SPLIT
          Editor preference controlling when a tag's attributes are split across multiple lines.
static String PREFERENCE_LITERAL_SPLIT
          Editor preference controlling when literals are wrapped across multiple lines.
static String PREFERENCE_MAXIMUM_LINE_LENGTH
          Editor preference controlling the preferred line length.
static String PREFERENCE_SUBSTITUTE_SPACES
          Editor preference controlling whether spaces are substituted for tab characters.
static String PREFERENCE_TAB_WIDTH
          Editor preference controlling the width of a tab character, in spaces.
static String PREFERENCE_TAG_INDENT
          Editor preference controlling the amount of indentation for nested tags and literals.
static int SPLIT_ALWAYS
          Attribute split constant indicating that attributes should always be split across multiple lines.
static int SPLIT_LONG
          Attribute split constant indicating that attributes should be split across multiple lines only if they exceed PREFERENCE_MAXIMUM_LINE_LENGTH.
static int SPLIT_NEVER
          Attribute split constant indicating that attributes should never be split across multiple lines.
 
Constructor Summary
EditorPlugin()
          Creates a new editor plugin and sets it as the singleton instance.
 
Method Summary
static boolean alignAttributes()
          Indicates whether or not wrapped attributes should be aligned with the name of the containing tag, based on editor preferences.
static boolean alignAttributeValues()
          Indicates whether or not the values of wrapped attributes should be aligned, based on editor preferences.
static String getAttributeDelimeter()
          Returns the delimeter to be used for attribute values, based on editor preferences.
static int getAttributeIndent()
          Returns the indentation amount for wrapped attributes, based on editor preferences.
static String getID()
          Retrieves the plugin's ID from the resource bundle.
static int getMaximumLineLength()
          Returns the maximum line length for the OWL source editor, based on editor preferences.
static EditorPlugin getPlugin()
          Returns the one and only instance of EditorPlugin.
 ResourceBundle getResourceBundle()
          Retrieves the plugin's resource bundle.
static String getResourceString(String key)
          Returns the string from the plugin's resource bundle, or 'key' if not found.
static int getTabWidth()
          Returns the width in spaces of the tab character, based on editor preferences.
static int getTagIndent()
          Returns the indentation amount for nested tags and literals, based on editor preferences.
static void insertNode(IOWLDocument doc, OASTNode node, boolean bBefore)
          Deprecated. As of SWeDE 2.0.0, the OAST API should be used to insert nodes into the document.
static void insertNode(IOWLDocument doc, OASTNode parent, OASTNode node, boolean bBefore)
          Deprecated. As of SWeDE 2.0.0, the OAST API should be used to insert nodes into the document.
static boolean spacesForTabs()
          Indicates whether spaces should be substituted for tab characters, based on editor preferences.
static boolean splitAttributes(int iLineLength)
          Indicates whether a tag's attributes should be wrapped across multiple lines, based on editor preferences and the length of the line containing the tag.
static boolean splitLiteral(int iLineLength)
          Indicates whether a literal should be wrapped across multiple lines, based on editor preferences and the length of the line containing it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFERENCE_TAB_WIDTH

public static final String PREFERENCE_TAB_WIDTH
Editor preference controlling the width of a tab character, in spaces. This affects both how tab characters are displayed and how many spaces are substituted if PREFERENCE_SUBSTITUTE_SPACES is set to true.

See Also:
Constant Field Values

PREFERENCE_SUBSTITUTE_SPACES

public static final String PREFERENCE_SUBSTITUTE_SPACES
Editor preference controlling whether spaces are substituted for tab characters.

See Also:
Constant Field Values

PREFERENCE_MAXIMUM_LINE_LENGTH

public static final String PREFERENCE_MAXIMUM_LINE_LENGTH
Editor preference controlling the preferred line length. Other options will allow text to automatically be wrapped if this length is exceeded.

See Also:
Constant Field Values

PREFERENCE_TAG_INDENT

public static final String PREFERENCE_TAG_INDENT
Editor preference controlling the amount of indentation for nested tags and literals.

See Also:
Constant Field Values

PREFERENCE_ATTRIBUTE_SPLIT

public static final String PREFERENCE_ATTRIBUTE_SPLIT
Editor preference controlling when a tag's attributes are split across multiple lines. The value of this preference should be one of the SPLIT_* constants.

See Also:
Constant Field Values

PREFERENCE_ATTRIBUTE_INDENT

public static final String PREFERENCE_ATTRIBUTE_INDENT
Editor preference controlling how wrapped attributes are indented.

See Also:
Constant Field Values

PREFERENCE_ATTRIBUTE_DELIMITER

public static final String PREFERENCE_ATTRIBUTE_DELIMITER
Editor preference controlling use of single vs. double quotes for attribute values.

See Also:
Constant Field Values

PREFERENCE_ATTRIBUTE_ALIGN

public static final String PREFERENCE_ATTRIBUTE_ALIGN
Editor preference controlling whether attributes are aligned with the end of the tag's name. If this preference is set to false, the value of PREFERENCE_ATTRIBUTE_INDENT will be used for indented attributes in all tags.

See Also:
Constant Field Values

PREFERENCE_ATTRIBUTE_ALIGN_VALUE

public static final String PREFERENCE_ATTRIBUTE_ALIGN_VALUE
Editor preference controlling whether the '=' is aligned for wrapped attributes.

See Also:
Constant Field Values

PREFERENCE_LITERAL_SPLIT

public static final String PREFERENCE_LITERAL_SPLIT
Editor preference controlling when literals are wrapped across multiple lines. The value of this preference should be one of the SPLIT_* constants.

See Also:
Constant Field Values

SPLIT_NEVER

public static final int SPLIT_NEVER
Attribute split constant indicating that attributes should never be split across multiple lines.

See Also:
Constant Field Values

SPLIT_ALWAYS

public static final int SPLIT_ALWAYS
Attribute split constant indicating that attributes should always be split across multiple lines.

See Also:
Constant Field Values

SPLIT_LONG

public static final int SPLIT_LONG
Attribute split constant indicating that attributes should be split across multiple lines only if they exceed PREFERENCE_MAXIMUM_LINE_LENGTH.

See Also:
Constant Field Values
Constructor Detail

EditorPlugin

public EditorPlugin()
Creates a new editor plugin and sets it as the singleton instance.

Method Detail

getPlugin

public static EditorPlugin getPlugin()
Returns the one and only instance of EditorPlugin.

Returns:
The singleton instance

getResourceString

public static String getResourceString(String key)
Returns the string from the plugin's resource bundle, or 'key' if not found.

Parameters:
key - The key for the desired resource string
Returns:
The resource string for key.

getResourceBundle

public ResourceBundle getResourceBundle()
Retrieves the plugin's resource bundle.

Returns:
The resource bundle

insertNode

public static void insertNode(IOWLDocument doc,
                              OASTNode node,
                              boolean bBefore)
Deprecated. As of SWeDE 2.0.0, the OAST API should be used to insert nodes into the document.

Inserts a new node into an OWL document, directly under the rdf:RDF tag The document will be opened in the editor automatically.

Parameters:
doc - The document to receive the new node
node - The node being inserted
bBefore - true to insert the node before any existing tags under rdf:RDF, false to insert after all existing nodes under rdf:RDF.

insertNode

public static void insertNode(IOWLDocument doc,
                              OASTNode parent,
                              OASTNode node,
                              boolean bBefore)
Deprecated. As of SWeDE 2.0.0, the OAST API should be used to insert nodes into the document.

Inserts a new node into an OWL document, directly under a specified parent node. The document will be opened in the editor automatically.

Parameters:
doc - The document to receive the new node
parent - The parent node of the new node
node - The node being inserted
bBefore - true to insert the node before any existing tags under rdf:RDF, false to insert after all existing nodes under rdf:RDF.

getID

public static String getID()
Retrieves the plugin's ID from the resource bundle.

Returns:
The plugin ID

spacesForTabs

public static boolean spacesForTabs()
Indicates whether spaces should be substituted for tab characters, based on editor preferences.

Returns:
true if spaces should be substituted, false to allow tab characters

getTabWidth

public static int getTabWidth()
Returns the width in spaces of the tab character, based on editor preferences.

Returns:
The width of a tab character

getTagIndent

public static int getTagIndent()
Returns the indentation amount for nested tags and literals, based on editor preferences.

Returns:
The number of tabs to indent between open and close tags.

getAttributeIndent

public static int getAttributeIndent()
Returns the indentation amount for wrapped attributes, based on editor preferences.

Returns:
The number of tabs to indent wrapped attributes inside an open or singleton tag.

getMaximumLineLength

public static int getMaximumLineLength()
Returns the maximum line length for the OWL source editor, based on editor preferences.

Returns:
The maximum number of characters allowed on a line before literals and attributes are wrapped

splitLiteral

public static boolean splitLiteral(int iLineLength)
Indicates whether a literal should be wrapped across multiple lines, based on editor preferences and the length of the line containing it.

Parameters:
iLineLength - The length of the line containing the literal
Returns:
true if the literal should be wrapped, false if it should remain on one line.

splitAttributes

public static boolean splitAttributes(int iLineLength)
Indicates whether a tag's attributes should be wrapped across multiple lines, based on editor preferences and the length of the line containing the tag.

Parameters:
iLineLength - The length of the line containing the open tag.
Returns:
true if the tag's attributes should be wrapped, false if they should remain on one line.

getAttributeDelimeter

public static String getAttributeDelimeter()
Returns the delimeter to be used for attribute values, based on editor preferences.

Returns:
A string containing the character used to delimit attributes, either ' or "

alignAttributes

public static boolean alignAttributes()
Indicates whether or not wrapped attributes should be aligned with the name of the containing tag, based on editor preferences.

Returns:
true if attributes should be aligned with the tag name, false to indent them all based on getAttributeIndent().

alignAttributeValues

public static boolean alignAttributeValues()
Indicates whether or not the values of wrapped attributes should be aligned, based on editor preferences.

Returns:
true if values should be aligned, false if not.


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