org.openide.util.actions
Class CallbackSystemAction

java.lang.Object
  |
  +--org.openide.util.SharedClassObject
        |
        +--org.openide.util.actions.SystemAction
              |
              +--org.openide.util.actions.CallableSystemAction
                    |
                    +--org.openide.util.actions.CallbackSystemAction
All Implemented Interfaces:
Action, ActionListener, EventListener, Externalizable, Presenter, Presenter.Menu, Presenter.Popup, Presenter.Toolbar, Serializable
Direct Known Subclasses:
AddWatchAction, CloneViewAction, CloseViewAction, CopyAction, CutAction, DeleteAction, FindAction, FinishDebuggerAction, GotoAction, NextTabAction, PopupAction, PreviousTabAction, ReplaceAction, StepOutAction, ToggleBreakpointAction, TraceOverAction, UndockAction

public abstract class CallbackSystemAction
extends CallableSystemAction

Action that can have a performer of the action attached to it at any time, or changed. The action will be automatically disabled when it has no performer.

Also may be made sensitive to changes in window focus.

See Also:
Serialized Form

Inner classes inherited from class org.openide.util.actions.Presenter
Presenter.Menu, Presenter.Popup, Presenter.Toolbar
 
Fields inherited from class org.openide.util.actions.SystemAction
PROP_ENABLED, PROP_ICON
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
CallbackSystemAction()
           
 
Method Summary
 ActionPerformer getActionPerformer()
          Get the current action performer.
 boolean getSurviveFocusChange()
          Test whether the action will survive a change in focus.
protected  void initialize()
          Initialize the action to have no performer.
 void performAction()
          Perform the action.
 void setActionPerformer(ActionPerformer performer)
          Set the action performer.
 void setSurviveFocusChange(boolean b)
          Set whether the action will survive a change in focus.
 
Methods inherited from class org.openide.util.actions.CallableSystemAction
actionPerformed, getMenuPresenter, getPopupPresenter, getToolbarPresenter
 
Methods inherited from class org.openide.util.actions.SystemAction
clearSharedData, createPopupMenu, createToolbarPresenter, get, getHelpCtx, getIcon, getIcon, getName, getValue, iconResource, isEnabled, linkActions, putValue, setEnabled, setIcon
 
Methods inherited from class org.openide.util.SharedClassObject
addNotify, addPropertyChangeListener, equals, finalize, findObject, findObject, firePropertyChange, getLock, getProperty, hashCode, putProperty, putProperty, readExternal, removeNotify, removePropertyChangeListener, writeExternal, writeReplace
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.Action
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

CallbackSystemAction

public CallbackSystemAction()
Method Detail

initialize

protected void initialize()
Initialize the action to have no performer.
Overrides:
initialize in class SystemAction

getActionPerformer

public ActionPerformer getActionPerformer()
Get the current action performer.
Returns:
the current action performer, or null if there is currently no performer

setActionPerformer

public void setActionPerformer(ActionPerformer performer)
Set the action performer. The specified value can be null, which means that the action will have no performer and is disabled. (SystemAction.isEnabled() will return false regardless its previous state.)
Parameters:
performer - the new action performer or null to disable

performAction

public void performAction()
Perform the action. This default implementation calls the assigned action performer if it exists, otherwise does nothing.
Overrides:
performAction in class CallableSystemAction

getSurviveFocusChange

public boolean getSurviveFocusChange()
Test whether the action will survive a change in focus. By default, it will not.
Returns:
true if the enabled state of the action survives focus changes

setSurviveFocusChange

public void setSurviveFocusChange(boolean b)
Set whether the action will survive a change in focus. If false, then the action will be automatically disabled (using setActionPerformer(org.openide.util.actions.ActionPerformer)) when the window focus changes.
Parameters:
b - true to survive focus changes, false to be sensitive to them


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.