com.borland.primetime.editor
Class EditorAction
java.lang.Object
|
+--javax.swing.AbstractAction
|
+--com.borland.primetime.editor.EditorAction
- Direct Known Subclasses:
- CUAActions.SetSubKeymapAction, EditorAction.SubKeymapAction, EditorActions.BeginAction, EditorActions.BeginLineAction, EditorActions.BeginWordAction, EditorActions.BottomOfScreenAction, EditorActions.ChangeWordCaseAction, EditorActions.CommentLineAction, EditorActions.CopyAction, EditorActions.CutAction, EditorActions.DefaultKeyTypedAction, EditorActions.DeleteBeginLineAction, EditorActions.DeleteBeginWordAction, EditorActions.DeleteEndLineAction, EditorActions.DeleteLineAction, EditorActions.DeleteNextCharAction, EditorActions.DeletePrevCharAction, EditorActions.DeleteSelectionAction, EditorActions.DeleteWordAction, EditorActions.EndAction, EditorActions.EndLineAction, EditorActions.EndWordAction, EditorActions.GotoBookmarkAction, EditorActions.GotoLineDialogAction, EditorActions.IncrementalSearchAction, EditorActions.IndentBlockAction, EditorActions.InsertTabAction, EditorActions.LowerCaseAction, EditorActions.MatchBraceAction, EditorActions.NextVisualPositionAction, EditorActions.NextWordAction, EditorActions.OpenLineAction, EditorActions.OutdentBlockAction, EditorActions.PageDownAction, EditorActions.PageLeftAction, EditorActions.PageRightAction, EditorActions.PageUpAction, EditorActions.PasteAction, EditorActions.PreviousIndentAction, EditorActions.PreviousWordAction, EditorActions.PrintAction, EditorActions.RecenterAction, EditorActions.RedoAction, EditorActions.ReplaceDialogAction, EditorActions.ScrollDownAction, EditorActions.ScrollUpAction, EditorActions.SearchAgainAction, EditorActions.SearchDialogAction, EditorActions.SelectAllAction, EditorActions.SelectLineAction, EditorActions.SelectWordAction, EditorActions.SetBookmarkAction, EditorActions.SetControlKAction, EditorActions.SmartBackspaceAction, EditorActions.SmartIndentAction, EditorActions.StripTrailingSpaceAction, EditorActions.TabKeyAction, EditorActions.TestAction, EditorActions.ToggleCaseAction, EditorActions.ToggleInsertModeAction, EditorActions.TopOfScreenAction, EditorActions.UndoAction, EditorActions.UnTabKeyAction, EditorActions.UpperCaseAction, TrackingKeymap.TrackingAction
- public abstract class EditorAction
- extends javax.swing.AbstractAction
An EditorAction object defines an action that will operate on an instance of
EditorPane.
This class is somewhat analogous to the javax.swing.text.TextAction class,
but it overcomes a very serious problem with that class: all TextActions
call getTextComponent(...)
to get a target, but that target is
determined by the last JTextComponent that had the focus. This results
in improper targeting in several cases (e.g. user types in one editor,
then invokes PasteAction in a separate browser).
Since this class is specialized for our purposes, it can determine its
target by using getEditorTarget(...)
, which returns a
EditorPane object. This target is maintained by a static member of
this class, and it is set by various components as a result of user actions.
- See Also:
TextAction
, Serialized Form
Inner Class Summary |
static class |
EditorAction.SubKeymapAction
The purpose of this class is to wrap an Action object that happens to be
bound in a sub keymap. |
Fields inherited from class javax.swing.AbstractAction |
changeSupport,
enabled |
Constructor Summary |
EditorAction(java.lang.String name)
Creates a new EditorAction object. |
Methods inherited from class javax.swing.AbstractAction |
actionPerformed,
addPropertyChangeListener,
clone,
firePropertyChange,
getValue,
isEnabled,
putValue,
removePropertyChangeListener,
setEnabled |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
EditorAction
public EditorAction(java.lang.String name)
- Creates a new EditorAction object.
- Parameters:
name
- the name of the action
getEditorTarget
protected final EditorPane getEditorTarget(java.awt.event.ActionEvent e)
- Determines the target of the action. This if fetched from the source of
the ActionEvent if it's not null and can be determined to be a
EditorPane. Otherwise, the last focused EditorPane is used.
- Parameters:
e
- the ActionEvent- Returns:
- the EditorPane to use as the target of this event.
setFocusedEditor
public static final void setFocusedEditor(EditorPane editor)
- Set the currently focused editor as the target. This method will be
called by an editor when it gets focus, and by other components when
other events occur (e.g. browserActivated).
- Parameters:
editor
- the EditorPane to set as the target.
getFocusedEditor
public static final EditorPane getFocusedEditor()
- Get the EditorPane which last had focus.
- Returns:
- the EditorPane which last had focus.