public abstract class CallableSystemAction extends SystemAction implements Presenter.Menu, Presenter.Popup, Presenter.Toolbar
<file name="your-pkg-action-id.instance"> <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/> <attr name="delegate" methodvalue="your.pkg.YourAction.factoryMethod"/> <attr name="displayName" bundlevalue="your.pkg.Bundle#key"/> <attr name="iconBase" stringvalue="your/pkg/YourImage.png"/> <!-- if desired: <attr name="noIconInMenu" boolvalue="false"/> --> </file>
Presenter.Menu, Presenter.Popup, Presenter.ToolbarPROP_ENABLED, PROP_ICONACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON| Constructor and Description |
|---|
CallableSystemAction() |
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(ActionEvent ev)
Actually perform the action.
|
protected boolean |
asynchronous()
If true, this action should be performed asynchronously in a private thread.
|
JMenuItem |
getMenuPresenter()
Get a menu item that can present this action in a
JMenu. |
JMenuItem |
getPopupPresenter()
Get a menu item that can present this action in a
JPopupMenu. |
Component |
getToolbarPresenter()
Get a component that can present this action in a
JToolBar. |
abstract void |
performAction()
Actually perform the action.
|
clearSharedData, createPopupMenu, createToolbarPresenter, get, getHelpCtx, getIcon, getIcon, getName, getValue, iconResource, initialize, isEnabled, linkActions, putValue, setEnabled, setIconaddNotify, addPropertyChangeListener, equals, finalize, findObject, findObject, firePropertyChange, getLock, getProperty, hashCode, putProperty, putProperty, readExternal, removeNotify, removePropertyChangeListener, reset, writeExternal, writeReplaceclone, getClass, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, removePropertyChangeListenerpublic JMenuItem getMenuPresenter()
Presenter.MenuJMenu.
If your menu content is dynamic in nature, consider using DynamicMenuContentgetMenuPresenter in interface Presenter.Menupublic JMenuItem getPopupPresenter()
Presenter.PopupJPopupMenu.
If your menu content is dynamic in nature, consider using DynamicMenuContentgetPopupPresenter in interface Presenter.Popuppublic Component getToolbarPresenter()
Presenter.ToolbarJToolBar.getToolbarPresenter in interface Presenter.Toolbarpublic abstract void performAction()
See SystemAction.actionPerformed(java.awt.event.ActionEvent) for a note on
threading usage: in particular, do not access GUI components
without explicitly asking for the AWT event thread!
public void actionPerformed(ActionEvent ev)
SystemActionActionListener.actionPerformed(java.awt.event.ActionEvent).
In some cases, the implementation may have an empty body, if the presenters handle the performing of the action in a different way than by calling this method.
Since 4.11, will be performed directly in the event thread.
actionPerformed in interface ActionListeneractionPerformed in class SystemActionev - the event triggering the actionprotected boolean asynchronous()
The default value is true for compatibility reasons; subclasses are strongly
encouraged to override it to be false, and to either do their work promptly
in the event thread and return, or to somehow do work asynchronously (for example
using RequestProcessor.getDefault()).
You may currently set the global default to false
by setting the system property
org.openide.util.actions.CallableSystemAction.synchronousByDefault
to true.
When true, the current implementation also provides for a wait cursor during the execution of the action. Subclasses which override to return false should consider directly providing a wait or busy cursor if the nature of the action merits it.
Built on August 24 2014. | Portions Copyright 1997-2014 Sun Microsystems, Inc. All rights reserved.