Package org.fife.ui.rtextarea
Class RecordableTextAction
java.lang.Object
javax.swing.AbstractAction
javax.swing.text.TextAction
org.fife.ui.rtextarea.RecordableTextAction
- All Implemented Interfaces:
ActionListener
,Serializable
,Cloneable
,EventListener
,Action
- Direct Known Subclasses:
RSyntaxTextAreaEditorKit.CloseCurlyBraceAction
,RSyntaxTextAreaEditorKit.CloseMarkupTagAction
,RSyntaxTextAreaEditorKit.CopyCutAsStyledTextAction
,RSyntaxTextAreaEditorKit.DecreaseIndentAction
,RSyntaxTextAreaEditorKit.FoldRelatedAction
,RSyntaxTextAreaEditorKit.GoToMatchingBracketAction
,RSyntaxTextAreaEditorKit.InsertTabAction
,RSyntaxTextAreaEditorKit.PossiblyInsertTemplateAction
,RSyntaxTextAreaEditorKit.ToggleCommentAction
,RTextAreaEditorKit.BeepAction
,RTextAreaEditorKit.BeginAction
,RTextAreaEditorKit.BeginLineAction
,RTextAreaEditorKit.BeginRecordingMacroAction
,RTextAreaEditorKit.BeginWordAction
,RTextAreaEditorKit.ClipboardHistoryAction
,RTextAreaEditorKit.CopyAction
,RTextAreaEditorKit.CutAction
,RTextAreaEditorKit.DecreaseFontSizeAction
,RTextAreaEditorKit.DefaultKeyTypedAction
,RTextAreaEditorKit.DeleteLineAction
,RTextAreaEditorKit.DeleteNextCharAction
,RTextAreaEditorKit.DeletePrevCharAction
,RTextAreaEditorKit.DeletePrevWordAction
,RTextAreaEditorKit.DeleteRestOfLineAction
,RTextAreaEditorKit.DumbCompleteWordAction
,RTextAreaEditorKit.EndAction
,RTextAreaEditorKit.EndLineAction
,RTextAreaEditorKit.EndRecordingMacroAction
,RTextAreaEditorKit.EndWordAction
,RTextAreaEditorKit.IncreaseFontSizeAction
,RTextAreaEditorKit.InsertBreakAction
,RTextAreaEditorKit.InsertContentAction
,RTextAreaEditorKit.InsertTabAction
,RTextAreaEditorKit.InvertSelectionCaseAction
,RTextAreaEditorKit.JoinLinesAction
,RTextAreaEditorKit.LineMoveAction
,RTextAreaEditorKit.LowerSelectionCaseAction
,RTextAreaEditorKit.NextBookmarkAction
,RTextAreaEditorKit.NextOccurrenceAction
,RTextAreaEditorKit.NextVisualPositionAction
,RTextAreaEditorKit.NextWordAction
,RTextAreaEditorKit.PageAction
,RTextAreaEditorKit.PasteAction
,RTextAreaEditorKit.PlaybackLastMacroAction
,RTextAreaEditorKit.PreviousOccurrenceAction
,RTextAreaEditorKit.PreviousWordAction
,RTextAreaEditorKit.RedoAction
,RTextAreaEditorKit.ScrollAction
,RTextAreaEditorKit.SelectAllAction
,RTextAreaEditorKit.SelectLineAction
,RTextAreaEditorKit.SelectWordAction
,RTextAreaEditorKit.SetReadOnlyAction
,RTextAreaEditorKit.SetWritableAction
,RTextAreaEditorKit.TimeDateAction
,RTextAreaEditorKit.ToggleBookmarkAction
,RTextAreaEditorKit.ToggleTextModeAction
,RTextAreaEditorKit.UndoAction
,RTextAreaEditorKit.UnselectAction
,RTextAreaEditorKit.UpperSelectionCaseAction
,RTextAreaEditorKit.VerticalPageAction
The base action used by the actions defined in
RTextAreaEditorKit
. This action is what allows instances of
RTextArea
to record keystrokes into "macros;" if an action is
recordable and occurs while the user is recording a macro, it adds itself to
the currently-being-recorded macro.- Version:
- 0.5
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
Whether this text action should be recorded in a macro.Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
This method is final so that you cannot override it and mess up the macro-recording part of it.abstract void
actionPerformedImpl
(ActionEvent e, RTextArea textArea) The actual meat of the action.Returns the accelerator for this action.Returns the description for this action.getIcon()
Returns the icon for this action.abstract String
Returns the identifier for this macro.int
Returns the mnemonic for this action.getName()
Returns the name of this action.Returns the short description for this action.boolean
Returns whether this action will be recorded and replayed in a macro.void
setAccelerator
(KeyStroke accelerator) Sets the accelerator for this action.void
setMnemonic
(char mnemonic) Sets the mnemonic for this action.void
setMnemonic
(Integer mnemonic) Sets the mnemonic for this action.void
Sets the name of this action.void
setProperties
(ResourceBundle msg, String keyRoot) Sets the name, mnemonic, and description of this action.void
setRecordable
(boolean recordable) Sets whether this action will be recorded and replayed in a macro.void
setShortDescription
(String shortDesc) Sets the short description for this action.Methods inherited from class javax.swing.text.TextAction
augmentList, getFocusedComponent, getTextComponent
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
isRecordable
private boolean isRecordableWhether this text action should be recorded in a macro.
-
-
Constructor Details
-
RecordableTextAction
Constructor.- Parameters:
text
- The text (name) associated with the action.
-
RecordableTextAction
public RecordableTextAction(String text, Icon icon, String desc, Integer mnemonic, KeyStroke accelerator) Constructor.- Parameters:
text
- The text (name) associated with the action.icon
- The icon associated with the action.desc
- The description of the action.mnemonic
- The mnemonic for the action.accelerator
- The accelerator key for the action.
-
-
Method Details
-
actionPerformed
This method is final so that you cannot override it and mess up the macro-recording part of it. The actual meat of the action is inactionPerformedImpl
.- Parameters:
e
- The action being performed.- See Also:
-
actionPerformedImpl
The actual meat of the action. If you wish to subclass this action and modify its behavior, this is the method to override.- Parameters:
e
- The action being performed.textArea
- The text area "receiving" the action.- See Also:
-
getAccelerator
Returns the accelerator for this action.- Returns:
- The accelerator.
- See Also:
-
getDescription
Returns the description for this action.- Returns:
- The description.
-
getIcon
Returns the icon for this action.- Returns:
- The icon.
-
getMacroID
Returns the identifier for this macro. This method makes it so that you can create an instance of theRTextAreaEditorKit.CutAction
action, for example, rename it to "Remove", and it will still be recorded as a "cut" action. Subclasses should return a unique string from this method; preferably the name of the action.If you subclass a
RecordableTextAction
, you should NOT override this method; if you do, the action may not be properly recorded in a macro.- Returns:
- The internally-used macro ID.
-
getMnemonic
public int getMnemonic()Returns the mnemonic for this action.- Returns:
- The mnemonic, or
-1
if not defined. - See Also:
-
getName
Returns the name of this action.- Returns:
- The name of this action.
- See Also:
-
getShortDescription
Returns the short description for this action.- Returns:
- The short description for this action.
- See Also:
-
isRecordable
public boolean isRecordable()Returns whether this action will be recorded and replayed in a macro.- Returns:
- Whether this action will be recorded and replayed.
- See Also:
-
setAccelerator
Sets the accelerator for this action.- Parameters:
accelerator
- The new accelerator.- See Also:
-
setMnemonic
public void setMnemonic(char mnemonic) Sets the mnemonic for this action.- Parameters:
mnemonic
- The new mnemonic.- See Also:
-
setMnemonic
Sets the mnemonic for this action.- Parameters:
mnemonic
- The new mnemonic.- See Also:
-
setName
Sets the name of this action.- Parameters:
name
- The new name.- See Also:
-
setProperties
Sets the name, mnemonic, and description of this action.- Parameters:
msg
- The resource bundle.keyRoot
- The root of the keys for the properties. ".Name
", ".Mnemonic
", and ".Desc
" will be appended to create the key for each property.
-
setRecordable
public void setRecordable(boolean recordable) Sets whether this action will be recorded and replayed in a macro.- Parameters:
recordable
- Whether this action should be recorded and replayed.- See Also:
-
setShortDescription
Sets the short description for this action.- Parameters:
shortDesc
- The short description for this action.
-