|
org.eclipse.rse.ui.actions
Class SystemBaseWizardAction
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.rse.ui.actions.SystemBaseAction
org.eclipse.rse.ui.actions.SystemBaseDialogAction
org.eclipse.rse.ui.actions.SystemBaseWizardAction
-
All Implemented Interfaces:
-
IAction,
ISelectionChangedListener,
ISystemAction,
ISystemDialogAction,
ISystemWizardAction
-
Direct Known Subclasses:
-
SystemNewConnectionAction,
SystemNewFilterAction
-
public abstract class SystemBaseWizardAction
- extends
SystemBaseDialogAction
- implements
ISystemWizardAction
A specialization for the eclipse Action method, for actions that put up wizards.
This class is most effective when used with actions that extend
AbstractSystemWizard ,
or implement
ISystemWizard . It supports
settings that are propogated to the wizard, and wizard pages if they extend
AbstractSystemWizardPage ,
or implement
ISystemWizardPage .
The advantages to using this class over the base action class are:
- Supports setting the label, description, image and tooltip text for this action, via constructors.
- Sets
SystemBaseAction.allowOnMultipleSelection(boolean) to false, since most wizard actions are not permitted on multiple selection.
- Supports setting whether the wizard requires a
progress-monitor or not, which is propogated to the wizard.
- Supports setting the overall wizard
title , which is propogated to the wizard.
- Supports setting the overall wizard
image , which is propogated to the wizard.
- Supports setting the default wizard
page-title , which is propogated to the wizard and the wizard pages.
- Supports setting the wizard;s default
contextual-help , which is propogated to the wizard and the wizard pages.
- Supports setting the wizard's
minimum-size , which is propogated and applied to the wizard.
- Supports a
wasCancelled() method so the caller can easily determine if the wizard was dismissed or cancelled by the user.
- Supports propogation of the
current-viewer .
To use this class:
- Create your wizard class that extends
AbstractSystemWizard , and is populated with
pages that extend
AbstractSystemWizardPage .
- Define your action's label and tooltip translatable strings in a resource bundle, where the former's key ends with "label" and the latter's
key ends with "tooltip".
- Define your subclass of this wizard. Decide if you want to set the wizard's title, page-title, image, help and optionally minimum size
in your wizard subclass, or here in your action subclass. For re-use it is best to set it in the wizard, if possible.
- Override
createWizard() to instantiate, configure and return your wizard.
- Decide if you will do the work of the wizard in the wizard's performFinish method, or here in this action subclass. If here,
override
postProcessWizard(IWizard) . You might also override this if you need to set output variables in the action,
after the sucessful completion of the wizard.
Fields inherited from interface org.eclipse.jface.action.
IAction
|
AS_CHECK_BOX,
AS_DROP_DOWN_MENU,
AS_PUSH_BUTTON,
AS_RADIO_BUTTON,
AS_UNSPECIFIED,
CHECKED,
DESCRIPTION,
ENABLED,
HANDLED,
IMAGE,
RESULT,
TEXT,
TOOL_TIP_TEXT
|
Methods inherited from class org.eclipse.rse.ui.actions.
SystemBaseAction
|
allowOnMultipleSelection,
checkObjectType,
getContextMenuGroup,
getCurrentTreeView,
getFirstSelection,
getHelpContextId,
getNextSelection,
getRemoteAdapter,
getSelection,
getSelectionProvider,
getShell,
getShell,
getSystemConnection,
getViewAdapter,
getViewer,
isDummy,
isEnabled,
isSelectionSensitive,
issueTraceMessage,
selectionChanged,
setAvailableOffline,
setBusyCursor,
setContextMenuGroup,
setDisplayCursor,
setDisplayCursor,
setHelp,
setHost,
setInputs,
setSelection,
setSelectionProvider,
setSelectionSensitive,
setShell,
setTracing,
setTracing,
setViewer,
updateSelection
|
Methods inherited from class org.eclipse.jface.action.
Action
|
convertAccelerator,
convertAccelerator,
findKeyCode,
findKeyString,
findModifier,
findModifierString,
getAccelerator,
getActionDefinitionId,
getDescription,
getDisabledImageDescriptor,
getHelpListener,
getHoverImageDescriptor,
getId,
getImageDescriptor,
getMenuCreator,
getStyle,
getText,
getToolTipText,
isChecked,
isHandled,
notifyResult,
removeAcceleratorText,
removeMnemonics,
runWithEvent,
setAccelerator,
setActionDefinitionId,
setChecked,
setDescription,
setDisabledImageDescriptor,
setEnabled,
setHelpListener,
setHoverImageDescriptor,
setId,
setImageDescriptor,
setMenuCreator,
setText,
setToolTipText
|
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
Methods inherited from interface org.eclipse.rse.ui.actions.
ISystemAction
|
allowOnMultipleSelection,
getContextMenuGroup,
getHelpContextId,
getSelection,
getShell,
getViewer,
isDummy,
isSelectionSensitive,
setContextMenuGroup,
setHelp,
setInputs,
setSelection,
setSelectionSensitive,
setShell,
setViewer
|
Methods inherited from interface org.eclipse.jface.action.
IAction
|
addPropertyChangeListener,
getAccelerator,
getActionDefinitionId,
getDescription,
getDisabledImageDescriptor,
getHelpListener,
getHoverImageDescriptor,
getId,
getImageDescriptor,
getMenuCreator,
getStyle,
getText,
getToolTipText,
isChecked,
isEnabled,
isHandled,
removePropertyChangeListener,
run,
runWithEvent,
setAccelerator,
setActionDefinitionId,
setChecked,
setDescription,
setDisabledImageDescriptor,
setEnabled,
setHelpListener,
setHoverImageDescriptor,
setId,
setImageDescriptor,
setMenuCreator,
setText,
setToolTipText
|
SystemBaseWizardAction
protected SystemBaseWizardAction(
String text,
ImageDescriptor image,
Shell parent)
- Constructor for SystemBaseWizardAction when translated label is known. You must separately
call setToolTipText and setDescription to enable these if desired.
-
Parameters:
-
text - string to display in menu or toolbar -
image - icon to display in menu or toolbar. Can be null. -
parent - Shell of parent window. Can be null if you don't know it, but call setShell when you do.
SystemBaseWizardAction
protected SystemBaseWizardAction(
String text,
String tooltip,
ImageDescriptor image,
Shell parent)
- Constructor for SystemBaseWizardAction when translated label and tooltip are known. You must
separately call setDescription to enable this if desired.
-
Parameters:
-
text - string to display in menu or toolbar -
tooltip - string to display when user hovers mouse over action. -
image - icon to display in menu or toolbar. Can be null. -
parent - Shell of parent window. Can be null if you don't know it, but call setShell when you do.
SystemBaseWizardAction
protected SystemBaseWizardAction(
String text,
String tooltip,
String description,
ImageDescriptor image,
Shell parent)
- Constructor for SystemBaseWizardAction when translated label and tooltip and description are
all known.
-
Parameters:
-
text - string to display in menu or toolbar -
tooltip - string to display when user hovers mouse over action. -
description - string displayed in status bar of some displays. Longer than tooltip. -
image - icon to display in menu or toolbar. Can be null. -
parent - Shell of parent window. Can be null if you don't know it, but call setShell when you do.
setWizardTitle
public void setWizardTitle(
String title)
- Set the wizard title. Using this makes it possible to avoid subclassing a wizard
-
-
setWizardImage
public void setWizardImage(
ImageDescriptor wizardImage)
- Set the wizard image. Using this makes it possible to avoid subclassing a wizard
-
-
setWizardPageTitle
public void setWizardPageTitle(
String pageTitle)
- Set the wizard page title. Using this makes it possible to avoid subclassing.
The page title goes below the wizard title, and can be unique per page. However,
typically the wizard page title is the same for all pages... eg "Filter".
This is not used by default, but can be queried via getPageTitle() when constructing
pages.
-
-
getWizardPageTitle
public
String getWizardPageTitle()
- Return the page title as set via setWizardPageTitle
-
-
setMinimumPageSize
public void setMinimumPageSize(int width,
int height)
- Call this method to set the wizard's dimensions without having to subclass the wizard.
If you pass zero for either value, then the default will be used for that.
-
-
createDialog
protected final
Dialog createDialog(
Shell shell)
- Override of parent's method. Does the following:
- Calls abstract createWizard() method to get wizard instance
- If wizard implements ISystemWizard, calls setInputValue(...), passing in
getValue() if not null, else passing in getFirstSelection() if not null.
- Instantiates a WizardDialog object with the wizard object from createWizard().
Returns this to run() in our parent class which then opens this dialog.
-
-
Specified by:
-
createDialog
in class
SystemBaseDialogAction
-
-
See Also:
-
SystemBaseDialogAction.run()
doCreateWizardDialog
protected
WizardDialog doCreateWizardDialog(
Shell shell,
IWizard wizard)
- Creates the dialog instance. Called from
createDialog(...) .
Gives overrides the chance to plug-in their own specialized wizard dialog
implementations.
-
-
-
Parameters:
-
shell - The shell to create the dialog in. Must be not null . -
wizard - The wizard to create the wizard dialog for. Must be not null .
-
Returns:
- The wizard dialog instance. Must be never
null .
createWizard
protected abstract
IWizard createWizard()
- The default processing for the run method calls createDialog, which
we override in this class. The implementation of createDialog calls
this method that you must override, to create the wizard. The result
goes into a WizardDialog which is opened and hence displayed to the
user.
-
-
getDialogValue
protected
Object getDialogValue(
Dialog dlg)
- By default, we try to get the wizard's value by calling getOutputObject()
-
-
Specified by:
-
getDialogValue
in class
SystemBaseDialogAction
-
-
Parameters:
-
dlg - The dialog object, after it has returned from open.
postProcessWizard
protected void postProcessWizard(
IWizard wizard)
- Typically, the wizard's performFinish method does the work required by
a successful finish of the wizard. However, often we also want to be
able to extract user-entered data from the wizard, by calling getters
in this action. To enable this, override this method to populate your
output instance variables from the completed wizard, which is passed
as a parameter. This is only called after successful completion of the
wizard.
-
-
wasCancelled
public boolean wasCancelled()
- Returns true if the user cancelled the wizard.
This is an override of the parent method, since we can be more
accurate with wizards than we can with dialogs.
-
-
Specified by:
-
wasCancelled
in interface
ISystemDialogAction
-
Overrides:
-
wasCancelled
in class
SystemBaseDialogAction
-
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.
|
|