com.borland.primetime.editor
Class EditorManager

java.lang.Object
  |
  +--com.borland.primetime.editor.EditorManager

public class EditorManager
extends java.lang.Object

The EditorManager class manages all of the editors currently active in the system. It is also used to create new ones. The EditorManager is also responsible for maintaining information that is global to all of the editors (e.g. tabsize, fontsize, margins, colors). There is always only a single EditorManager in the system. It instantiates itself when it is first needed.


Field Summary
static java.lang.String backgroundColorAttribute
          Name of the attribute that specifies the default background color of the managed editors.
static java.lang.String blinkCaretAttribute
           
static java.lang.String blockIndentAttribute
          Name of the attribute that specifies the block indent size for managed editors.
static java.lang.String createBackupFileAttribute
           
static java.lang.Object EDITOR_TOPIC
          This is the editor topic, used for PropertyPageFactories.
static java.lang.String fontAttribute
          Name of the attribute that specifies the font for managed editors.
static java.lang.String fontSizeAttribute
          Name of the attribute that specifies the font size for managed editors.
static java.lang.String foregroundColorAttribute
          Name of the attribute that specifies the default foreground color of the managed editors.
static java.lang.String indentAfterBraceAttribute
          Name of the attribute that specifies whether or not to add an extra level of indentation for every extra open brace found on the previous non-blank line.
static java.lang.String insertModeAttribute
          Name of the attribute that specifies whether or not the managed editors are in insert mode.
static java.lang.String internationalInputMethods
           
static java.lang.String keymapAttribute
          Name of the attribute that specifies the keymap for the managed editors.
static java.lang.String rightMarginAttribute
          Name of the attribute that specifies the right margin line of the managed editors.
static java.lang.String smartEndAttribute
          Name of the attribute that specifies whether or not to use SmartEnd for the EndLineAction.
static java.lang.String smartHomeAttribute
          Name of the attribute that specifies whether or not to use SmartHome for the BeginLineAction.
static java.lang.String smartIndentAttribute
          Name of the attribute that specifies whether or not to use Smart Indent when the user types the key.
static java.lang.String smartTabsAttribute
          Name of the attribute that specifies whether or not to use SmartTabs.
static java.lang.String stripTrailingSpaceAttribute
           
static java.lang.String styleContextAttribute
          Name of the attribute that specifies the StyleContext for the managed editors.
static java.lang.String tabSizeAttribute
          Name of the attribute that specifies the tab size for managed editors.
static java.lang.String useSyntaxHighlightAttribute
          Name of the attribute that specifies whether or not to use color syntax highlighting when painting the file.
static java.lang.String useTabCharAttribute
          Name of the attribute that specifies whether or not to use the character ('\t') for spacing.
static java.lang.String visibleMarginAttribute
          Name of the attribute that specifies whether or not the right margin line of the managed editors is visible.
 
Method Summary
static void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
static void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener for a specific property.
static EditorPane configureEditor(EditorPane editor, TextEditorKit kit)
           
static EditorPane createEditor(TextEditorKit kit)
          Create a new EditorPane.
static javax.swing.text.Keymap createKeymap(java.lang.String keymapName, javax.swing.text.JTextComponent.KeyBinding[] bindings, javax.swing.Action[] actions)
           
static javax.swing.text.Keymap createSubKeymap(java.lang.String keymapName, javax.swing.text.Keymap masterKeymap, javax.swing.text.JTextComponent.KeyBinding[] bindings, javax.swing.Action[] actions)
           
static int getBlockIndent()
           
static TextEditorKit getEditorKit()
           
static TextEditorKit getEditorKit(java.lang.Class keyClass)
          Retrieve an editor kit.
static EditorOption getEditorOption(java.lang.String key)
          Get a particular editor option based on its key name.
static EditorOption[] getEditorOptions()
           
static java.awt.Font getFont()
           
static javax.swing.text.Keymap getKeymap()
           
static javax.swing.text.Keymap getKeymap(java.lang.String keymapName)
          Retrieve a keymap by name.
static java.lang.String getKeymapName()
           
static java.lang.Object getProperty(java.lang.Object key)
          Look up a property value using the specified key.
static int getRightMargin()
           
static MasterStyleContext getStyleContext()
           
static int getTabSize()
           
static void initOpenTool(byte majorVersion, byte minorVersion)
           
static boolean isBooleanOptionValue(java.lang.String key)
          Get the value of a particular boolean editor editor option based on its key name.
static boolean isIndentAfterBrace()
           
static boolean isInsertMode()
           
static boolean isSmartEnd()
           
static boolean isSmartHome()
           
static boolean isSmartIndent()
           
static boolean isSmartTabs()
           
static boolean isUseSyntaxHighlight()
           
static boolean isUseTabChar()
           
static boolean isVisibleMargin()
           
static void putProperty(java.lang.Object key, java.lang.Object value)
          Store a property value using the specified key.
static void registerEditorKit(TextEditorKit kit)
          Register an editor kit.
static void registerEditorOption(EditorOption opt)
           
static void registerKeymap(javax.swing.text.Keymap keymap)
          Register a keymap.
static void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
static void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener for a specific property.
static void setBackgroundColor(java.awt.Color c)
           
static void setBlockIndent(int newSize)
           
static void setFont(java.awt.Font f)
           
static void setForegroundColor(java.awt.Color c)
           
static void setIndentAfterBrace(boolean b)
           
static void setInsertMode(boolean mode)
           
static void setKeymap(javax.swing.text.Keymap keymap)
           
static void setKeymapName(java.lang.String keymapName)
           
static void setOptionValue(BooleanEditorOption opt, boolean value)
          Set a binary editor option value.
static void setRightMargin(int column)
           
static void setSmartEnd(boolean b)
           
static void setSmartHome(boolean b)
           
static void setSmartIndent(boolean b)
           
static void setSmartTabs(boolean b)
           
static void setStyleContext(MasterStyleContext styleContext)
           
static void setTabSize(int newSize)
           
static void setUseSyntaxHighlight(boolean b)
           
static void setUseTabChar(boolean b)
           
static void setVisibleMargin(boolean visible)
           
static void showStatusMessage(EditorPane editor, java.lang.String message, boolean appendOnly, boolean temporary)
           
static void showStatusMessage(EditorPane editor, java.lang.String message, boolean appendOnly, boolean temporary, boolean paintImmediately)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blinkCaretAttribute

public static final java.lang.String blinkCaretAttribute

createBackupFileAttribute

public static final java.lang.String createBackupFileAttribute

stripTrailingSpaceAttribute

public static final java.lang.String stripTrailingSpaceAttribute

internationalInputMethods

public static final java.lang.String internationalInputMethods

EDITOR_TOPIC

public static final java.lang.Object EDITOR_TOPIC
This is the editor topic, used for PropertyPageFactories.

blockIndentAttribute

public static final java.lang.String blockIndentAttribute
Name of the attribute that specifies the block indent size for managed editors. The type for the value is Integer.

tabSizeAttribute

public static final java.lang.String tabSizeAttribute
Name of the attribute that specifies the tab size for managed editors. The type for the value is Integer.

useTabCharAttribute

public static final java.lang.String useTabCharAttribute
Name of the attribute that specifies whether or not to use the character ('\t') for spacing. The type for the value is Boolean. If this is false, use spaces instead.

smartIndentAttribute

public static final java.lang.String smartIndentAttribute
Name of the attribute that specifies whether or not to use Smart Indent when the user types the key. The type for the value is Boolean.

indentAfterBraceAttribute

public static final java.lang.String indentAfterBraceAttribute
Name of the attribute that specifies whether or not to add an extra level of indentation for every extra open brace found on the previous non-blank line. This only works when smartIndent is active. The type for the value is Boolean.

smartHomeAttribute

public static final java.lang.String smartHomeAttribute
Name of the attribute that specifies whether or not to use SmartHome for the BeginLineAction. SmartHome moves the caret to right after the first, non-blank character on a line. The type for the value is Boolean.

smartEndAttribute

public static final java.lang.String smartEndAttribute
Name of the attribute that specifies whether or not to use SmartEnd for the EndLineAction. SmartEnd moves the caret right after the last, non-blank character on a line. The type for the value is Boolean.

smartTabsAttribute

public static final java.lang.String smartTabsAttribute
Name of the attribute that specifies whether or not to use SmartTabs. The type for the value is Boolean.
See Also:
EditorActions#InsertTabAction

useSyntaxHighlightAttribute

public static final java.lang.String useSyntaxHighlightAttribute
Name of the attribute that specifies whether or not to use color syntax highlighting when painting the file. The type for the value is Boolean.

fontAttribute

public static final java.lang.String fontAttribute
Name of the attribute that specifies the font for managed editors. The type for the value is Font.

fontSizeAttribute

public static final java.lang.String fontSizeAttribute
Name of the attribute that specifies the font size for managed editors. The type for the value is Integer.

insertModeAttribute

public static final java.lang.String insertModeAttribute
Name of the attribute that specifies whether or not the managed editors are in insert mode. The type for the value is Boolean.

foregroundColorAttribute

public static final java.lang.String foregroundColorAttribute
Name of the attribute that specifies the default foreground color of the managed editors. The type for the value is Color.

backgroundColorAttribute

public static final java.lang.String backgroundColorAttribute
Name of the attribute that specifies the default background color of the managed editors. The type for the value is Color.

visibleMarginAttribute

public static final java.lang.String visibleMarginAttribute
Name of the attribute that specifies whether or not the right margin line of the managed editors is visible. The type for the value is Boolean

rightMarginAttribute

public static final java.lang.String rightMarginAttribute
Name of the attribute that specifies the right margin line of the managed editors. The type for the value is Integer.

keymapAttribute

public static final java.lang.String keymapAttribute
Name of the attribute that specifies the keymap for the managed editors. The type for the value is Keymap.

styleContextAttribute

public static final java.lang.String styleContextAttribute
Name of the attribute that specifies the StyleContext for the managed editors. The type for the value is MasterStyleContext.
Method Detail

initOpenTool

public static void initOpenTool(byte majorVersion,
                                byte minorVersion)

registerEditorOption

public static void registerEditorOption(EditorOption opt)

getEditorOptions

public static EditorOption[] getEditorOptions()

setOptionValue

public static void setOptionValue(BooleanEditorOption opt,
                                  boolean value)
Set a binary editor option value. Calling this method ensures that all listeners are notified of the propertyChange.

getEditorOption

public static EditorOption getEditorOption(java.lang.String key)
Get a particular editor option based on its key name.

isBooleanOptionValue

public static boolean isBooleanOptionValue(java.lang.String key)
Get the value of a particular boolean editor editor option based on its key name.

registerEditorKit

public static void registerEditorKit(TextEditorKit kit)
Register an editor kit. EditorKits are stored in a map and retrieved using their class as the key.
Parameters:
kit - The TextEditorKit to register.
See Also:
getEditorKit(java.lang.Class)

getEditorKit

public static TextEditorKit getEditorKit(java.lang.Class keyClass)
Retrieve an editor kit. EditorKits are stored in a map and retrieved using their class as the key.
Parameters:
keyClass - The class of the TextEditorKit being retrieved.
See Also:
registerEditorKit(com.borland.primetime.editor.TextEditorKit)

registerKeymap

public static void registerKeymap(javax.swing.text.Keymap keymap)
Register a keymap. Keymaps are stored in a map and retrieved using their name as the key.
Parameters:
kit - The TextEditorKit to register.
See Also:
getEditorKit(java.lang.Class)

getKeymap

public static javax.swing.text.Keymap getKeymap(java.lang.String keymapName)
Retrieve a keymap by name.
Parameters:
keymapName - The name of the Keymap being retrieved.
See Also:
registerKeymap(javax.swing.text.Keymap)

setBlockIndent

public static void setBlockIndent(int newSize)

getBlockIndent

public static int getBlockIndent()

setTabSize

public static void setTabSize(int newSize)

getTabSize

public static int getTabSize()

setUseTabChar

public static void setUseTabChar(boolean b)

isUseTabChar

public static boolean isUseTabChar()

setSmartIndent

public static void setSmartIndent(boolean b)

isSmartIndent

public static boolean isSmartIndent()

setIndentAfterBrace

public static void setIndentAfterBrace(boolean b)

isIndentAfterBrace

public static boolean isIndentAfterBrace()

setSmartHome

public static void setSmartHome(boolean b)

isSmartHome

public static boolean isSmartHome()

setSmartEnd

public static void setSmartEnd(boolean b)

isSmartEnd

public static boolean isSmartEnd()

setSmartTabs

public static void setSmartTabs(boolean b)

isSmartTabs

public static boolean isSmartTabs()

setUseSyntaxHighlight

public static void setUseSyntaxHighlight(boolean b)

isUseSyntaxHighlight

public static boolean isUseSyntaxHighlight()

setFont

public static void setFont(java.awt.Font f)

getFont

public static java.awt.Font getFont()

setInsertMode

public static void setInsertMode(boolean mode)

isInsertMode

public static boolean isInsertMode()

setForegroundColor

public static void setForegroundColor(java.awt.Color c)

setBackgroundColor

public static void setBackgroundColor(java.awt.Color c)

setVisibleMargin

public static void setVisibleMargin(boolean visible)

isVisibleMargin

public static boolean isVisibleMargin()

setRightMargin

public static void setRightMargin(int column)

getRightMargin

public static int getRightMargin()

setKeymapName

public static void setKeymapName(java.lang.String keymapName)

getKeymapName

public static java.lang.String getKeymapName()

setKeymap

public static void setKeymap(javax.swing.text.Keymap keymap)

getKeymap

public static javax.swing.text.Keymap getKeymap()

setStyleContext

public static void setStyleContext(MasterStyleContext styleContext)

getStyleContext

public static MasterStyleContext getStyleContext()

getEditorKit

public static TextEditorKit getEditorKit()

createEditor

public static EditorPane createEditor(TextEditorKit kit)
Create a new EditorPane. Using this method ensures that the class is constructed correctly, with all of the proper default settings. This method also registers the newly created editor with the EditorManager.
Parameters:
kit - The TextEditorKit to use.
Returns:
the newly created EditorPane.

configureEditor

public static EditorPane configureEditor(EditorPane editor,
                                         TextEditorKit kit)

createKeymap

public static javax.swing.text.Keymap createKeymap(java.lang.String keymapName,
                                                   javax.swing.text.JTextComponent.KeyBinding[] bindings,
                                                   javax.swing.Action[] actions)

createSubKeymap

public static javax.swing.text.Keymap createSubKeymap(java.lang.String keymapName,
                                                      javax.swing.text.Keymap masterKeymap,
                                                      javax.swing.text.JTextComponent.KeyBinding[] bindings,
                                                      javax.swing.Action[] actions)

showStatusMessage

public static void showStatusMessage(EditorPane editor,
                                     java.lang.String message,
                                     boolean appendOnly,
                                     boolean temporary)

showStatusMessage

public static void showStatusMessage(EditorPane editor,
                                     java.lang.String message,
                                     boolean appendOnly,
                                     boolean temporary,
                                     boolean paintImmediately)

getProperty

public static final java.lang.Object getProperty(java.lang.Object key)
Look up a property value using the specified key.
Parameters:
key - the non-null property key
Returns:
the value of this property or null

putProperty

public static final void putProperty(java.lang.Object key,
                                     java.lang.Object value)
Store a property value using the specified key. If value is null this method will remove the property.
Parameters:
key - the non-null key
value - the value

addPropertyChangeListener

public static void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.
Parameters:
listener - The PropertyChangeListener to be added

removePropertyChangeListener

public static void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.
Parameters:
listener - The PropertyChangeListener to be removed

addPropertyChangeListener

public static void addPropertyChangeListener(java.lang.String propertyName,
                                             java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property.
Parameters:
propertyName - The name of the property to listen on.
listener - The PropertyChangeListener to be added

removePropertyChangeListener

public static void removePropertyChangeListener(java.lang.String propertyName,
                                                java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener for a specific property.
Parameters:
propertyName - The name of the property that was listened on.
listener - The PropertyChangeListener to be removed