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 alignClosingCurlyBraceAttribute
          Name of the attribute that specifies whether or not to align the indentation level of the closing curly brace with the opening curly brace.
static java.lang.String backgroundColorAttribute
          Name of the attribute that specifies the default background color of the managed editors.
static java.lang.String blinkCaretAttribute
          The attribute that specifies if the caret should be blinking.
static java.lang.String blockIndentAttribute
          Name of the attribute that specifies the block indent size for managed editors.
static java.lang.String caretAttribute
          Name of the attribute that specifies the caret for the managed editors.
static java.lang.String createBackupFileAttribute
          The attribute that specifies if backup files should be created.
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 insertLeadingTabsAttribute
          Name of the attribute that specifies that all leading blanks in the file should be changed to leading TAB characters in the most optimal way at the time the file is saved.
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
          The attribute that specifies if International Input Methods should be enabled.
static java.lang.String keymapAttribute
          Name of the attribute that specifies the keymap for the managed editors.
static java.lang.String removeLeadingTabsAttribute
          Name of the attribute that specifies that all real TAB characters should be removed from the file when the file is saved.
static java.lang.String rightMarginAttribute
          Name of the attribute that specifies the right margin line of the managed editors.
static java.lang.String searchWordAtCursorAttribute
          Name of the attribute that specifies that a search in the editor should initialize the search box with the word under the cursor.
static java.lang.String showSearchDialogAttribute
          Name of the attribute that specifies that a dialog box should pop up when a search in the current file fails to come up with any (more) results.
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
          The attribute that specifies if trailing spaces should be deleted when the file is saved.
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)
          Configure the incoming editor pane using the current settings and add this editor pane as a listener.
static EditorPane createEditor(TextEditorKit kit)
          Create a new EditorPane.
static javax.swing.text.Keymap createKeymap(javax.swing.text.Keymap map, javax.swing.text.JTextComponent.KeyBinding[] bindings, javax.swing.Action[] actions)
          Bind the supplied bindings and actions into the supplied keymap.
static javax.swing.text.Keymap createKeymap(java.lang.String keymapName, javax.swing.text.JTextComponent.KeyBinding[] bindings, javax.swing.Action[] actions)
          Create a new keymap with the supplied name and the supplied bindings and 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)
          Create a new sub-keymap with the supplied name and the supplied master keymap and the supplied bindings and actions.
static void customizeKeymap(java.lang.Object keymap)
          Allow the user to customize a keymap.
static java.util.HashMap getActionMap()
          Get all the actions that are applicable to the current keymap.
static int getBlockIndent()
          Get the indent size the editor currently is using.
static javax.swing.text.Caret getCaret()
          Returns a newly minted instance of the currently installed caret.
static java.util.ArrayList getContextActions(ActionGroup group)
          Query all the EditorContextActionProviders by calling their getContextAction method, and adding the actions returned by the getContextAction methods in an array to be added to the incoming action group.
static EditorPane getEditor(Node node)
          Examines a Node and determines if its viewer has an EditorPane associated with it, and if so, returns that EditorPane.
static TextEditorKit getEditorKit()
          Get the editor kit that the editor is currently using.
static TextEditorKit getEditorKit(java.lang.Class keyClass)
          Retrieve an editor kit.
static EditorOption getEditorOption(java.lang.String key)
          Get a previously registered editor option based on its key name.
static EditorOption[] getEditorOptions()
          Get all the options that were previously registered through the registerEditorOption function.
static java.awt.Font getFont()
          Get the font the editor is currently using.
static javax.swing.text.Keymap getKeymap()
          Return the currently installed keymap.
static javax.swing.text.Keymap getKeymap(java.lang.String keymapName)
          Retrieve a keymap by name.
static javax.swing.Action getKeymapCustomizer()
          Get the currently installed keymap customizer.
static java.lang.String getKeymapName()
          Get the name of the currently installed keymap.
static java.lang.Object getProperty(java.lang.Object key)
          Look up a property value using the specified key.
static int getRightMargin()
          Get the column at which the right margin is displayed.
static MasterStyleContext getStyleContext()
          Get the style context that the editor is currently using for syntax highlighting.
static int getTabSize()
          Get the tab size the editor is currently using.
static void initOpenTool(byte majorVersion, byte minorVersion)
          Initialize all the options and all the OpenTools definitions.
static boolean isAlignClosingCurlyBrace()
          Ask the editor if it is aligning closing curly braces.
static boolean isBlinkCaret()
          Ask the editor if the caret is blinking.
static boolean isBooleanOptionValue(java.lang.String key)
          Get the value of a previously registered editor option based on its key name.
static boolean isCreateBackupFile()
          Ask the editor if it is creating backup files.
static boolean isIndentAfterBrace()
          Ask the editor if it is indenting after an opening curly brace.
static boolean isInsertLeadingTabs()
          Ask the editor if leading spaces are replaced with tabs.
static boolean isInsertMode()
          Ask the editor if it is inserting or overstriking.
static boolean isInternationalInputMethods()
          Ask the editor if international input methods is on.
static boolean isRemoveLeadingTabs()
          Ask the editor if leading tabs are replaced with spaces.
static boolean isSearchWordAtCursor()
          Ask the editor if the search box should be initialized with the word under the caret.
static boolean isShowSearchDialog()
          Ask the editor if a dialog appears if a search fails.
static boolean isSmartEnd()
          Ask the editor if the end key is smart.
static boolean isSmartHome()
          Ask the editor if the home key is smart.
static boolean isSmartIndent()
          Ask the editor if it is using smart indent.
static boolean isSmartTabs()
          Ask the editor if the tabbing is done smartly.
static boolean isStripTrailingSpace()
          Ask the editor if trailing spaces are stripped.
static boolean isUseSyntaxHighlight()
          Ask the editor if syntax highlighting is on.
static boolean isUseTabChar()
          Ask the editor if it is using hard coded tab characters.
static boolean isVisibleMargin()
          Ask the editor if it is displaying the right margin.
static void putProperty(java.lang.Object key, java.lang.Object value)
          Store a property value using the specified key.
static void registerContextActionProvider(EditorContextActionProvider provider)
          Register an EditorContextActionProvider and insert it in the sorted list of providers based on decreasing priority.
static void registerEditorKit(TextEditorKit kit)
          Register an editor kit.
static void registerEditorOption(EditorOption opt)
          Register an editor option in this central place.
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 setAlignClosingCurlyBrace(boolean b)
          Tell the editor if it should align closing curly braces.
static void setBackgroundColor(java.awt.Color c)
          Set the new background color the editor should be using.
static void setBlinkCaret(boolean b)
          Tell the editor if the caret should be blinking.
static void setBlockIndent(int newSize)
          Set the indent size that the editor will use.
static void setCaret(java.lang.Class caret)
          The EditorManager manages the caret that all editors will use.
static void setCreateBackupFile(boolean b)
          Tell the editor if it should create backup files.
static void setFont(java.awt.Font f)
          Set the font that the editor will use.
static void setForegroundColor(java.awt.Color c)
          Set the new foreground color the editor should be using.
static void setIndentAfterBrace(boolean b)
          Tell the editor if it should indent after an opening curly brace.
static void setInsertLeadingTabs(boolean b)
          Tell the editor if it should replace leading spaces with tabs on saving.
static void setInsertMode(boolean mode)
          Tell the editor if it should use insert or overstrike mode.
static void setInternationalInputMethods(boolean b)
          Tell the editor if it should use International Input Methods.
static void setKeymap(javax.swing.text.Keymap keymap)
          Set the keymap that the editor should be using.
static void setKeymapCustomizer(javax.swing.Action action)
          Set the keymap customizer action which, when its actionPerformed function is called, should allow the user to customize the currently installed keymap.
static void setKeymapName(java.lang.String keymapName)
          Set the keymap that the editor should be using.
static void setOptionValue(BooleanEditorOption opt, boolean value)
          Set a binary editor option value.
static void setRemoveLeadingTabs(boolean b)
          Tell the editor if it should replace leading tabs with spaces on saving.
static void setRightMargin(int column)
          Set the column at which the right margin should be displayed.
static void setSearchWordAtCursor(boolean b)
          Tell the editor if it should initialize the search box with the word under the caret when a search is performed.
static void setShowSearchDialog(boolean b)
          Tell the editor if it should pop up a dialog when a search fails.
static void setSmartEnd(boolean b)
          Tell the editor if it should make the end key smart.
static void setSmartHome(boolean b)
          Tell the editor if it should make the home key smarter.
static void setSmartIndent(boolean b)
          Tell the editor if it should use smart indent.
static void setSmartTabs(boolean b)
          Tell the editor if it should make tabbing smart.
static void setStripTrailingSpace(boolean b)
          Tell the editor if it should strip trailing spaces when saving.
static void setStyleContext(MasterStyleContext styleContext)
          Set the new style context that the editor should be using for syntax highlighting.
static void setTabSize(int newSize)
          Set the tab size that the editor will use.
static void setUseSyntaxHighlight(boolean b)
          Tell the editor if it should use syntax highlighting.
static void setUseTabChar(boolean b)
          Tell the editor if it should use hard coded tab characters when possible.
static void setVisibleMargin(boolean visible)
          Tell the editor if it should display the right margin.
static void showStatusMessage(EditorPane editor, java.lang.String message, boolean appendOnly, boolean temporary)
          Show a message in the status bar of the IDE.
static void showStatusMessage(EditorPane editor, java.lang.String message, boolean appendOnly, boolean temporary, boolean paintImmediately)
          Show a message in the status bar of the IDE.
 
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
The attribute that specifies if the caret should be blinking.

createBackupFileAttribute

public static final java.lang.String createBackupFileAttribute
The attribute that specifies if backup files should be created.

stripTrailingSpaceAttribute

public static final java.lang.String stripTrailingSpaceAttribute
The attribute that specifies if trailing spaces should be deleted when the file is saved.

internationalInputMethods

public static final java.lang.String internationalInputMethods
The attribute that specifies if International Input Methods should be enabled.

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.

alignClosingCurlyBraceAttribute

public static final java.lang.String alignClosingCurlyBraceAttribute
Name of the attribute that specifies whether or not to align the indentation level of the closing curly brace with the opening curly brace. 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.

caretAttribute

public static final java.lang.String caretAttribute
Name of the attribute that specifies the caret for the managed editors. The type for the value is Class.

removeLeadingTabsAttribute

public static final java.lang.String removeLeadingTabsAttribute
Name of the attribute that specifies that all real TAB characters should be removed from the file when the file is saved. The type for the value is boolean.

insertLeadingTabsAttribute

public static final java.lang.String insertLeadingTabsAttribute
Name of the attribute that specifies that all leading blanks in the file should be changed to leading TAB characters in the most optimal way at the time the file is saved. The type for the value is boolean.

showSearchDialogAttribute

public static final java.lang.String showSearchDialogAttribute
Name of the attribute that specifies that a dialog box should pop up when a search in the current file fails to come up with any (more) results. The type for the value is boolean.

searchWordAtCursorAttribute

public static final java.lang.String searchWordAtCursorAttribute
Name of the attribute that specifies that a search in the editor should initialize the search box with the word under the cursor. The type for the value is boolean.
Method Detail

initOpenTool

public static void initOpenTool(byte majorVersion,
                                byte minorVersion)
Initialize all the options and all the OpenTools definitions.

registerEditorOption

public static void registerEditorOption(EditorOption opt)
Register an editor option in this central place. This is mostly a convenience function.
Parameters:
opt - The option that should be registered.

getEditorOptions

public static EditorOption[] getEditorOptions()
Get all the options that were previously registered through the registerEditorOption function.
Returns:
an array of options previously registered.

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.
Parameters:
opt - the option that should be modified.
value - the new value of the option.

getEditorOption

public static EditorOption getEditorOption(java.lang.String key)
Get a previously registered editor option based on its key name.
Parameters:
key - The name of the desired option.
Returns:
The option, null if that option doesn't exist.

isBooleanOptionValue

public static boolean isBooleanOptionValue(java.lang.String key)
Get the value of a previously registered editor option based on its key name. Since this function returns false if the option doesn't exist, it might be wise to call getEditorOption instead if the existence of the option is in doubt.
Parameters:
key - The name of the option whose value is wanted
Returns:
The value of the option, false if that option doesn't exist.

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. At this time the keymaps are registered in the kit.
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.
Returns:
The desired editor kit, null if that editor kit doesn't exist.
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. At this time each registered kit is told about the new keymap, and the keymap editor is told about all the actions in the keymap.
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.
Returns:
the desired keymap, or null if it doesn't exist.
See Also:
registerKeymap(javax.swing.text.Keymap)

setBlockIndent

public static void setBlockIndent(int newSize)
Set the indent size that the editor will use. All listeners will be told that something has changed.
Parameters:
newSize - the new indent size.

getBlockIndent

public static int getBlockIndent()
Get the indent size the editor currently is using.
Returns:
the current indent size.

setTabSize

public static void setTabSize(int newSize)
Set the tab size that the editor will use. At certain times, like during smart indent, the editor will try to replace "tab size" number of spaces with a hardcoded tab character. Contrary to what would be expected, a hard code tab is not inserted when the user hits the tab key. All listeners will be told that something has changed.
Parameters:
newSize - The new tab size for the editor.

getTabSize

public static int getTabSize()
Get the tab size the editor is currently using.
Returns:
the current tab size.

setUseTabChar

public static void setUseTabChar(boolean b)
Tell the editor if it should use hard coded tab characters when possible.
Parameters:
b - the new useTabChar value.

isUseTabChar

public static boolean isUseTabChar()
Ask the editor if it is using hard coded tab characters.
Returns:
true if the editor uses hard coded tabs, false otherwise.

setSmartIndent

public static void setSmartIndent(boolean b)
Tell the editor if it should use smart indent.
Parameters:
b - The new value of smartIndent

isSmartIndent

public static boolean isSmartIndent()
Ask the editor if it is using smart indent.
Returns:
true if the editor is using smart indent, false otherwise.

setIndentAfterBrace

public static void setIndentAfterBrace(boolean b)
Tell the editor if it should indent after an opening curly brace.
Parameters:
b - The new value of IndentAfterBrace.

isIndentAfterBrace

public static boolean isIndentAfterBrace()
Ask the editor if it is indenting after an opening curly brace.
Returns:
true if the editor is indenting after a brace, false otherwise.

setAlignClosingCurlyBrace

public static void setAlignClosingCurlyBrace(boolean b)
Tell the editor if it should align closing curly braces.
Parameters:
b - The new value of AlignClosingCurlyBrace

isAlignClosingCurlyBrace

public static boolean isAlignClosingCurlyBrace()
Ask the editor if it is aligning closing curly braces.
Returns:
true if the editor is aligning braces, false otherwise.

setSmartHome

public static void setSmartHome(boolean b)
Tell the editor if it should make the home key smarter.
Parameters:
b - the new value of SmartHome.

isSmartHome

public static boolean isSmartHome()
Ask the editor if the home key is smart.
Returns:
true if the home key is smart, false otherwise.

setSmartEnd

public static void setSmartEnd(boolean b)
Tell the editor if it should make the end key smart.
Parameters:
b - the new value of SmartEnd.

isSmartEnd

public static boolean isSmartEnd()
Ask the editor if the end key is smart.
Returns:
true if the end key is smart, false otherwise.

setSmartTabs

public static void setSmartTabs(boolean b)
Tell the editor if it should make tabbing smart.
Parameters:
b - the new value of SmartTabs.

isSmartTabs

public static boolean isSmartTabs()
Ask the editor if the tabbing is done smartly.
Returns:
true if tabbing is smart, false otherwise.

setBlinkCaret

public static void setBlinkCaret(boolean b)
Tell the editor if the caret should be blinking.
Parameters:
b - the new value of BlinkCaret.

isBlinkCaret

public static boolean isBlinkCaret()
Ask the editor if the caret is blinking.
Returns:
true if the caret is blinking, false otherwise.

setCreateBackupFile

public static void setCreateBackupFile(boolean b)
Tell the editor if it should create backup files.
Parameters:
b - the new value of CreateBackupFile.

isCreateBackupFile

public static boolean isCreateBackupFile()
Ask the editor if it is creating backup files.
Returns:
true if backup files are created, false otherwise.

setStripTrailingSpace

public static void setStripTrailingSpace(boolean b)
Tell the editor if it should strip trailing spaces when saving.
Parameters:
b - the new value of StripTrailingSpace.

isStripTrailingSpace

public static boolean isStripTrailingSpace()
Ask the editor if trailing spaces are stripped.
Returns:
true if trailing spaces are stripped, false otherwise.

setRemoveLeadingTabs

public static void setRemoveLeadingTabs(boolean b)
Tell the editor if it should replace leading tabs with spaces on saving.
Parameters:
b - the new value of RemoveLeadingTabs.

isRemoveLeadingTabs

public static boolean isRemoveLeadingTabs()
Ask the editor if leading tabs are replaced with spaces.
Returns:
true if leading tabs are replaced , false otherwise.

setInsertLeadingTabs

public static void setInsertLeadingTabs(boolean b)
Tell the editor if it should replace leading spaces with tabs on saving.
Parameters:
b - the new value of InsertLeadingTabs.

isInsertLeadingTabs

public static boolean isInsertLeadingTabs()
Ask the editor if leading spaces are replaced with tabs.
Returns:
true if leading spaces are replaced, false otherwise.

setInternationalInputMethods

public static void setInternationalInputMethods(boolean b)
Tell the editor if it should use International Input Methods.
Parameters:
b - the new value of InternationalInputMethods.

isInternationalInputMethods

public static boolean isInternationalInputMethods()
Ask the editor if international input methods is on.
Returns:
true if international input methods are on, false otherwise.

setUseSyntaxHighlight

public static void setUseSyntaxHighlight(boolean b)
Tell the editor if it should use syntax highlighting.
Parameters:
b - the new value of UseSyntaxHighlight.

isUseSyntaxHighlight

public static boolean isUseSyntaxHighlight()
Ask the editor if syntax highlighting is on.
Returns:
true if syntax highlighting is on, false otherwise.

setShowSearchDialog

public static void setShowSearchDialog(boolean b)
Tell the editor if it should pop up a dialog when a search fails.
Parameters:
b - the new value of ShowSearchDialog.

isShowSearchDialog

public static boolean isShowSearchDialog()
Ask the editor if a dialog appears if a search fails.
Returns:
true if the dialog does appear , false otherwise.

setSearchWordAtCursor

public static void setSearchWordAtCursor(boolean b)
Tell the editor if it should initialize the search box with the word under the caret when a search is performed.
Parameters:
b - the new value of SearchWordAtCursor.

isSearchWordAtCursor

public static boolean isSearchWordAtCursor()
Ask the editor if the search box should be initialized with the word under the caret.
Returns:
true if the search box gets the word under the caret, false otherwise.

setFont

public static void setFont(java.awt.Font f)
Set the font that the editor will use. All the listeners will be informed that something has changed.
Parameters:
f - the new font the editor should use.

getFont

public static java.awt.Font getFont()
Get the font the editor is currently using.
Returns:
the currently used font.

setInsertMode

public static void setInsertMode(boolean mode)
Tell the editor if it should use insert or overstrike mode.
Parameters:
mode - the new insert mode.

isInsertMode

public static boolean isInsertMode()
Ask the editor if it is inserting or overstriking.
Returns:
true if it is inserting, false if it's overstriking.

setForegroundColor

public static void setForegroundColor(java.awt.Color c)
Set the new foreground color the editor should be using. All listeners are told that something has changed.
Parameters:
c - the new foreground color.

setBackgroundColor

public static void setBackgroundColor(java.awt.Color c)
Set the new background color the editor should be using. All listeners are told that something has changed.
Parameters:
c - the new background color.

setVisibleMargin

public static void setVisibleMargin(boolean visible)
Tell the editor if it should display the right margin. All listeners are told that something has changed.
Parameters:
visible - true if the margin should be displayed, false otherwise.

isVisibleMargin

public static boolean isVisibleMargin()
Ask the editor if it is displaying the right margin.
Returns:
true if the margin is displayed, false otherwise.

setRightMargin

public static void setRightMargin(int column)
Set the column at which the right margin should be displayed. All listeners are told that something has changed.
Parameters:
column - the new column for the right margin.

getRightMargin

public static int getRightMargin()
Get the column at which the right margin is displayed.
Returns:
the column of the right margin.

setKeymapName

public static void setKeymapName(java.lang.String keymapName)
Set the keymap that the editor should be using. If the particular keymap doesn't exist, a warning message is displayed on stdout and the CUA keymap is installed instead. All listeners are told that something has changed.
Parameters:
keymapName - the name of the new keymap.

getKeymapName

public static java.lang.String getKeymapName()
Get the name of the currently installed keymap.
Returns:
the current keymap name.

setKeymap

public static void setKeymap(javax.swing.text.Keymap keymap)
Set the keymap that the editor should be using. All listeners are told that something has changed.
Parameters:
keymap - the new keymap that should be installed.

getKeymap

public static javax.swing.text.Keymap getKeymap()
Return the currently installed keymap.
Returns:
the currently installed keymap or null if no keymap is installed (yet).

setKeymapCustomizer

public static void setKeymapCustomizer(javax.swing.Action action)
Set the keymap customizer action which, when its actionPerformed function is called, should allow the user to customize the currently installed keymap.
Parameters:
action - The action that, when triggered, will allow the user to modify the currently installed keymap.

getKeymapCustomizer

public static javax.swing.Action getKeymapCustomizer()
Get the currently installed keymap customizer.
Returns:
the currently installed keymap customizer, or null if no keymap customizer has been installed.

customizeKeymap

public static void customizeKeymap(java.lang.Object keymap)
Allow the user to customize a keymap. This function will get the name of the keymap to customize from the toString() function applied on the incoming object. This keymap does not have to be the currently installed keymap, since this function will install the new keymap, accept the modifications, and reinstall the original keymap. If anything goes wrong and the keymap cannot be customized, a warning message dialog will be displayed. Internally this function will call the currently installed keymapCustomizerAction, which can be manipulated with the getKeymapCustomizerAction and setKeymapCustomizerAction.
Parameters:
keymap - The name of the keymap to customize is keymap.toString(). If keymap is null, the warning message dialog will be displayed.

setStyleContext

public static void setStyleContext(MasterStyleContext styleContext)
Set the new style context that the editor should be using for syntax highlighting.
Parameters:
styleContext - the new style context.

getStyleContext

public static MasterStyleContext getStyleContext()
Get the style context that the editor is currently using for syntax highlighting.
Returns:
the currently used style context.

getEditorKit

public static TextEditorKit getEditorKit()
Get the editor kit that the editor is currently using.
Returns:
the currently used editor kit.

getCaret

public static javax.swing.text.Caret getCaret()
Returns a newly minted instance of the currently installed caret. If for any reason the new instance can't be created, a new instance of EditorCaret is returned instead.
Returns:
A new caret instance
See Also:
setCaret(java.lang.Class)

setCaret

public static void setCaret(java.lang.Class caret)
The EditorManager manages the caret that all editors will use. This function can be used to notify the EditorManager that a new caret should be installed in all editors. By default, the EditorManager installs a copy of EditorCaret. The new caret class HAS to have a no-argument constructor, since the EditorManager has to create a new instance of the caret object for each editorPane. It also HAS to implement the Caret interface, and if it doesn't this function will throw an IllegalArgumentException
Parameters:
caret - The new caret class. If caret == null the default caret class will be installed, which is the EditorCaret class.

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)
Configure the incoming editor pane using the current settings and add this editor pane as a listener.
Parameters:
editor - the editor that should be configured.
kit - the kit that should be installed in the editor.
Returns:
the newly configured editor pane.

getEditor

public static EditorPane getEditor(Node node)
Examines a Node and determines if its viewer has an EditorPane associated with it, and if so, returns that EditorPane. Warning: By default, viewers don't create their EditorPane till the time they need them. This function will always try to create the EditorPane, so only use this function if you indeed want to work with the EditorPane. Use this function if you want to access an Editor opened in the Browser, but without the focus:


    Node[] nodes = Browser.getActiveBrowser().getOpenNodes();
    for (int i=0; i < nodes.length; i++) {
      if (nodes[i] instanceof JavaFileNode) {
        EditorPane editor = EditorManager.getEditor(nodes[i]);
        // Do work with the editor
      }
    }

 

If you want to access the Editor that currently has the focus, use the following code instead:


    EditorPane editor = EditorAction.getFocusedEditor();
    // Do work with the editor

 

Parameters:
node - The node that might have an EditorPane
Returns:
The EditorPane associated with the node, or null if no EditorPane was found.

createKeymap

public static javax.swing.text.Keymap createKeymap(java.lang.String keymapName,
                                                   javax.swing.text.JTextComponent.KeyBinding[] bindings,
                                                   javax.swing.Action[] actions)
Create a new keymap with the supplied name and the supplied bindings and actions. The new keymap will be compatible with all editors and will be able to use the keymap editor. This is the preferred way to create a new keymap. The two arrays, bindings and actions, should have the same length, since the members of the two will be linked to each other in the order provided.
Parameters:
keymapName - the name of the new keymap.
bindings - the bindings that should be linked to the actions.
actions - the actions that should be linked to the bindings.
Returns:
the new keymap.

createKeymap

public static javax.swing.text.Keymap createKeymap(javax.swing.text.Keymap map,
                                                   javax.swing.text.JTextComponent.KeyBinding[] bindings,
                                                   javax.swing.Action[] actions)
Bind the supplied bindings and actions into the supplied keymap. This function basically calls "JTextComponent.loadKeymap" and not much more. The two arrays, bindings and actions, should have the same length, since the members of the two will be linked to each other in the order provided.
Parameters:
map - the keymap that should receive the bindings and actions.
bindings - the bindings that should be linked to the actions.
actions - the actions that should be linked to the bindings.
Returns:
the updated keymap.

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)
Create a new sub-keymap with the supplied name and the supplied master keymap and the supplied bindings and actions. The new keymap will be compatible with all editors and will be able to use the keymap editor. This is the preferred way to create a new sub-keymap. The two arrays, bindings and actions, should have the same length, since the members of the two will be linked to each other in the order provided.
Parameters:
keymapName - the name of the new keymap.
masterKeymap - the name of the new keymap.
bindings - the bindings that should be linked to the actions.
actions - the actions that should be linked to the bindings.
Returns:
the new sub-keymap.

showStatusMessage

public static void showStatusMessage(EditorPane editor,
                                     java.lang.String message,
                                     boolean appendOnly,
                                     boolean temporary)
Show a message in the status bar of the IDE.
Parameters:
editor - the editor issuing the message.
message - the actual message.
appendOnly - if true, append to the message that is there already
temporary - if true, the message disappears after several seconds.

showStatusMessage

public static void showStatusMessage(EditorPane editor,
                                     java.lang.String message,
                                     boolean appendOnly,
                                     boolean temporary,
                                     boolean paintImmediately)
Show a message in the status bar of the IDE.
Parameters:
editor - the editor issuing the message.
message - the actual message.
appendOnly - if true, append to the message that is there already
temporary - if true, the message disappears after several seconds.
paintImmediately - if true, force a paint right away.

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

registerContextActionProvider

public static void registerContextActionProvider(EditorContextActionProvider provider)
Register an EditorContextActionProvider and insert it in the sorted list of providers based on decreasing priority. Priorities can range from 1 - 100, where a higher priority means the menu will show higher up in the context menu.
Parameters:
provider - The provider that wants to be registered.

getContextActions

public static java.util.ArrayList getContextActions(ActionGroup group)
Query all the EditorContextActionProviders by calling their getContextAction method, and adding the actions returned by the getContextAction methods in an array to be added to the incoming action group.
Parameters:
group - The action group that will receive the actions.
Returns:
an array of actions added to the incoming action group, or null if no actions were added.

getActionMap

public static java.util.HashMap getActionMap()
Get all the actions that are applicable to the current keymap.
Returns:
a list of current actions.