Package com.diffplug.common.swt.jface
Class Actions
java.lang.Object
com.diffplug.common.swt.jface.Actions
Provides a fluent interface for constructing actions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Style enum for various kinds of IAction. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns an action with the specified properties.static Actions
builder()
Defaults to a push style with no text, accelerator, or action.static Actions
builderCopy
(IAction action) Copies all behavior from the given action.static IAction
Concise method for creating a push action.static IAction
create
(String text, ImageDescriptor image, int accelerator, Runnable action) Concise method for creating a push action.static IAction
create
(String text, ImageDescriptor image, int accelerator, Listener listener) Concise method for creating a push action.static IAction
create
(String text, ImageDescriptor image, Runnable action) Concise method for creating a push action.static IAction
create
(String text, ImageDescriptor image, Listener listener) Concise method for creating a push action.static IAction
Concise method for creating a push action.static String
getAcceleratorString
(int accelerator) Returns the given key accelerator as a string (including shift, control, command, etc).static void
Updates the `isChecked()` property of the given IAction (if necessary), then calls IAction::run.static void
Updates the `isChecked()` property of the given IAction (if necessary), then calls IAction::runWithEvent.setAccelerator
(int accelerator) Sets the keyboard accelerator.setCallback
(BiConsumer<IAction, Event> callback) Sets the callback to be the given BiConsumer.setImage
(ImageDescriptor img) Sets the runnable.setListener
(Listener listener) Sets the callback to be the given Listener.setRunnable
(Runnable run) Sets the callback to be the given Runnable.setStyle
(Actions.Style style) Sets the style.Sets the text and tooltip.setTooltip
(String tooltip) Sets the tooltip.static void
setToolTipAccelAware
(IAction action, String tooltip) Sets the tooltip text for the given action while remaing aware of its accelerator.
-
Field Details
-
UC_ARROW_UP
Unicode for arrows.- See Also:
-
UC_ARROW_DOWN
- See Also:
-
UC_ARROW_LEFT
- See Also:
-
UC_ARROW_RIGHT
- See Also:
-
UC_CMD
Unicode for the Mac cmd icon.- See Also:
-
-
Method Details
-
create
Concise method for creating a push action. -
create
Concise method for creating a push action. -
create
Concise method for creating a push action. -
create
Concise method for creating a push action. -
create
Concise method for creating a push action. -
create
public static IAction create(String text, ImageDescriptor image, int accelerator, Listener listener) Concise method for creating a push action. -
builder
Defaults to a push style with no text, accelerator, or action. -
builderCopy
Copies all behavior from the given action. -
setText
Sets the text and tooltip. -
setTooltip
Sets the tooltip. -
setStyle
Sets the style. -
setRunnable
Sets the callback to be the given Runnable. -
setListener
Sets the callback to be the given Listener. It may receive a null event. -
setCallback
Sets the callback to be the given BiConsumer. Action will definitely be present, but event might be missing. -
setAccelerator
Sets the keyboard accelerator. -
setImage
Sets the runnable. -
build
Returns an action with the specified properties. -
setToolTipAccelAware
Sets the tooltip text for the given action while remaing aware of its accelerator. -
getAcceleratorString
Returns the given key accelerator as a string (including shift, control, command, etc). -
run
Updates the `isChecked()` property of the given IAction (if necessary), then calls IAction::run. -
run
Updates the `isChecked()` property of the given IAction (if necessary), then calls IAction::runWithEvent.
-