站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

BaseAction (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor
Class BaseAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by javax.swing.text.TextAction
          extended by org.netbeans.editor.BaseAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
ActionFactory.AbbrevExpandAction, ActionFactory.AbbrevResetAction, ActionFactory.AdjustCaretAction, ActionFactory.AdjustWindowAction, ActionFactory.AnnotationsCyclingAction, ActionFactory.ChangeCaseAction, ActionFactory.CollapseAllFolds, ActionFactory.CollapseFold, ActionFactory.CutToLineBeginOrEndAction, ActionFactory.DumpViewHierarchyAction, ActionFactory.ExpandAllFolds, ActionFactory.ExpandFold, ActionFactory.FindNextAction, ActionFactory.FindPreviousAction, ActionFactory.FindSelectionAction, ActionFactory.FirstNonWhiteAction, ActionFactory.FormatAction, ActionFactory.GenerateGutterPopupAction, ActionFactory.InsertDateTimeAction, ActionFactory.JumpListNextAction, ActionFactory.JumpListNextComponentAction, ActionFactory.JumpListPrevAction, ActionFactory.JumpListPrevComponentAction, ActionFactory.LastNonWhiteAction, ActionFactory.RedoAction, ActionFactory.ReindentLineAction, ActionFactory.RemoveLineAction, ActionFactory.RemoveLineBeginAction, ActionFactory.RemoveSelectionAction, ActionFactory.RemoveTabAction, ActionFactory.RemoveWordNextAction, ActionFactory.RemoveWordPreviousAction, ActionFactory.RunMacroAction, ActionFactory.ScrollDownAction, ActionFactory.ScrollUpAction, ActionFactory.SelectIdentifierAction, ActionFactory.SelectNextParameterAction, ActionFactory.ShiftLineAction, ActionFactory.StartMacroRecordingAction, ActionFactory.StartNewLine, ActionFactory.StopMacroRecordingAction, ActionFactory.ToggleHighlightSearchAction, ActionFactory.ToggleLineNumbersAction, ActionFactory.ToggleTypingModeAction, ActionFactory.UndoAction, ActionFactory.WordMatchAction, BaseKit.BackwardAction, BaseKit.BeepAction, BaseKit.BeginAction, BaseKit.BeginLineAction, BaseKit.BeginWordAction, BaseKit.CompoundAction, BaseKit.CopyAction, BaseKit.CutAction, BaseKit.DefaultKeyTypedAction, BaseKit.DeleteCharAction, BaseKit.DownAction, BaseKit.EndAction, BaseKit.EndLineAction, BaseKit.EndWordAction, BaseKit.ForwardAction, BaseKit.InsertBreakAction, BaseKit.InsertContentAction, BaseKit.InsertStringAction, BaseKit.InsertTabAction, BaseKit.KitCompoundAction, BaseKit.NextWordAction, BaseKit.PageDownAction, BaseKit.PageUpAction, BaseKit.PasteAction, BaseKit.PreviousWordAction, BaseKit.ReadOnlyAction, BaseKit.RemoveTrailingSpacesAction, BaseKit.SplitLineAction, BaseKit.UpAction, BaseKit.WritableAction, ExtKit.AllCompletionShowAction, ExtKit.BuildPopupMenuAction, ExtKit.BuildToolTipAction, ExtKit.CodeSelectAction, ExtKit.CommentAction, ExtKit.CompletionShowAction, ExtKit.CompletionTooltipShowAction, ExtKit.DocumentationShowAction, ExtKit.EscapeAction, ExtKit.FindAction, ExtKit.GotoAction, ExtKit.GotoDeclarationAction, ExtKit.MatchBraceAction, ExtKit.PrefixMakerAction, ExtKit.ReplaceAction, ExtKit.ShowPopupMenuAction, ExtKit.ToggleCaseIdentifierBeginAction, ExtKit.UncommentAction

public abstract class BaseAction
extends TextAction

This is the parent of majority of the actions. It implements the necessary resetting depending of what is required by constructor of target action. The other thing implemented here is macro recording.

See Also:
Serialized Form

Field Summary
static int ABBREV_RESET
          Reset abbreviation accounting to empty string
static int CLEAR_STATUS_TEXT
          Clear status bar text
static String ICON_RESOURCE_PROPERTY
          Resource for the icon
static String LOCALE_DESC_PREFIX
          Prefix for the name of the key for description in locale support
static String LOCALE_POPUP_PREFIX
          Prefix for the name of the key for popup description in locale support
static int MAGIC_POSITION_RESET
          Reset magic caret position
static String NO_KEYBINDING
          The name of Action property.
static int NO_RECORDING
          The action will not be recorded if in macro recording
static String POPUP_MENU_TEXT
          Text of the menu item in popup menu for this action
static int SAVE_POSITION
          Save current position in the jump list
static int SELECTION_REMOVE
          Remove the selected text at the action begining
static int UNDO_MERGE_RESET
          Prevents adding the new undoable edit to the old one when the next document change occurs.
protected  int updateMask
          Bit mask of what should be updated when the action is performed before the action's real task is invoked.
static int WORD_MATCH_RESET
          Reset word-match table
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
BaseAction(String name)
           
BaseAction(String name, int updateMask)
           
 
Method Summary
 void actionPerformed(ActionEvent evt)
          This method is made final here as there's an important processing that must be done before the real action functionality is performed.
abstract  void actionPerformed(ActionEvent evt, JTextComponent target)
          The target method that performs the real action functionality.
protected  boolean asynchonous()
           
protected  Object createDefaultValue(String key)
          This method is called when there is no value for the particular key.
protected  Object findValue(String key)
          Deprecated. this method is deprecated like the LocaleSupport which it uses by default. It should be replaced by implementing getShortDescriptionBundleClass()
protected  Object getDefaultShortDescription()
          Get the default value for Action.SHORT_DESCRIPTION property.
 JMenuItem getPopupMenuItem(JTextComponent target)
           
 String getPopupMenuText(JTextComponent target)
           
protected  Class getShortDescriptionBundleClass()
          Get the class in a package where resource bundle for localization of the short description of this action resides.
 Object getValue(String key)
           
protected  void settingsChange(SettingsChangeEvent evt, Class kitClass)
          This method is called once after the action is constructed and then each time the settings are changed.
 void updateComponent(JTextComponent target)
          Update the component according to the update mask specified in the constructor of the action.
 void updateComponent(JTextComponent target, int updateMask)
          Update the component according to the given update mask
 
Methods inherited from class javax.swing.text.TextAction
augmentList, getFocusedComponent, getTextComponent
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POPUP_MENU_TEXT

public static final String POPUP_MENU_TEXT
Text of the menu item in popup menu for this action

See Also:
Constant Field Values

LOCALE_DESC_PREFIX

public static final String LOCALE_DESC_PREFIX
Prefix for the name of the key for description in locale support

See Also:
Constant Field Values

LOCALE_POPUP_PREFIX

public static final String LOCALE_POPUP_PREFIX
Prefix for the name of the key for popup description in locale support

See Also:
Constant Field Values

ICON_RESOURCE_PROPERTY

public static final String ICON_RESOURCE_PROPERTY
Resource for the icon

See Also:
Constant Field Values

SELECTION_REMOVE

public static final int SELECTION_REMOVE
Remove the selected text at the action begining

See Also:
Constant Field Values

MAGIC_POSITION_RESET

public static final int MAGIC_POSITION_RESET
Reset magic caret position

See Also:
Constant Field Values

ABBREV_RESET

public static final int ABBREV_RESET
Reset abbreviation accounting to empty string

See Also:
Constant Field Values

UNDO_MERGE_RESET

public static final int UNDO_MERGE_RESET
Prevents adding the new undoable edit to the old one when the next document change occurs.

See Also:
Constant Field Values

WORD_MATCH_RESET

public static final int WORD_MATCH_RESET
Reset word-match table

See Also:
Constant Field Values

CLEAR_STATUS_TEXT

public static final int CLEAR_STATUS_TEXT
Clear status bar text

See Also:
Constant Field Values

NO_RECORDING

public static final int NO_RECORDING
The action will not be recorded if in macro recording

See Also:
Constant Field Values

SAVE_POSITION

public static final int SAVE_POSITION
Save current position in the jump list

See Also:
Constant Field Values

NO_KEYBINDING

public static final String NO_KEYBINDING
The name of Action property. If the action has property NO_KEYBINDING set to true, it won't be listed in editor keybindings customizer list.

See Also:
Constant Field Values

updateMask

protected int updateMask
Bit mask of what should be updated when the action is performed before the action's real task is invoked.

Constructor Detail

BaseAction

public BaseAction(String name)

BaseAction

public BaseAction(String name,
                  int updateMask)
Method Detail

findValue

protected Object findValue(String key)
Deprecated. this method is deprecated like the LocaleSupport which it uses by default. It should be replaced by implementing getShortDescriptionBundleClass()

Find a value in resource bundles.


getValue

public Object getValue(String key)
Specified by:
getValue in interface Action
Overrides:
getValue in class AbstractAction

createDefaultValue

protected Object createDefaultValue(String key)
This method is called when there is no value for the particular key.
If the returned value is non-null it is remembered by AbstractAction.putValue(String, Object) so in that case this method is only called once.

Note: When overriding this method super implementation should always be called.

Parameters:
key - key for which the default value should be found.
Returns:
default value or null if the default value does not exist for the given key.

getShortDescriptionBundleClass

protected Class getShortDescriptionBundleClass()
Get the class in a package where resource bundle for localization of the short description of this action resides.
By default this method returns null.


getDefaultShortDescription

protected Object getDefaultShortDescription()
Get the default value for Action.SHORT_DESCRIPTION property.
If this method returns non-empty value it will only be called once (its result will be remembered).

Returns:
value that will be use as result for Action.getValue(Action.SHORT_DESCRIPTION).

settingsChange

protected void settingsChange(SettingsChangeEvent evt,
                              Class kitClass)
This method is called once after the action is constructed and then each time the settings are changed.

Parameters:
evt - event describing the changed setting name. It's null if it's called after the action construction.
kitClass - class of the kit that created the actions

actionPerformed

public final void actionPerformed(ActionEvent evt)
This method is made final here as there's an important processing that must be done before the real action functionality is performed. It can include the following: 1. Updating of the target component depending on the update mask given in action constructor. 2. Possible macro recoding when the macro recording is turned on. The real action functionality should be done in the method actionPerformed(ActionEvent evt, JTextComponent target) which must be redefined by the target action.


actionPerformed

public abstract void actionPerformed(ActionEvent evt,
                                     JTextComponent target)
The target method that performs the real action functionality.

Parameters:
evt - action event describing the action that occured
target - target component where the action occured. It's retrieved by the TextAction.getTextComponent(evt).

asynchonous

protected boolean asynchonous()

getPopupMenuItem

public JMenuItem getPopupMenuItem(JTextComponent target)

getPopupMenuText

public String getPopupMenuText(JTextComponent target)

updateComponent

public void updateComponent(JTextComponent target)
Update the component according to the update mask specified in the constructor of the action.

Parameters:
target - target component to be updated.

updateComponent

public void updateComponent(JTextComponent target,
                            int updateMask)
Update the component according to the given update mask

Parameters:
target - target component to be updated.
updateMask - mask that specifies what will be updated

org.netbeans.modules.editor.lib/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.