|
RSE Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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
public abstract class SystemBaseDialogAction
A specialization for Action for actions that put up dialogs.
These actions have some common requirements:
This subclass of SystemBaseAction implements the run() method in a way optimized for the processing of dialogs: it calls an abstract method to create the dialog, then sets the input from the action's value (if set) or selection (otherwise) and opens the dialog. After, it calls an abstract method to extract the dialog's output object which is used to set this action's value, for the benefit of the caller.
To use this dialog, subclass it and override the following methods
:createDialog(Shell)
getDialogValue(Dialog)
run()
but ONLY if you don't want the default implementation of this method.
In addition to the methods you must override, you can optionally call various methods to configure this action. In addition to those in the parent class, this class offers these configuration methods:
setDialogHelp(String)
to set the context help ID for the dialog, for cases where the dialog is generic
and its help depends on context and hence cannot be hardcoded in the dialog class.
setValue(Object)
to the set the input object to pass to the dialog, for cases where the current selection
is not what you want to pass to the dialog.
setNeedsProgressMonitor(boolean)
to specify if the dialog is to display a progress monitor or not, for cases
where this decision depends on context and hence cannot be hardcoded in the dialog class.
setProcessAllSelections(boolean)
to specify the behaviour when there are multiple objects selected. By
default, the dialog will be created and processed once for each selected object, but you can specify that you instead
want to only invoke the dialog once and pass in all selected objects as a single ISelection object.
Field Summary | |
---|---|
protected boolean |
cancelled
|
protected String |
dlgHelpId
|
protected boolean |
needsProgressMonitor
|
protected boolean |
needsProgressMonitorSet
|
protected boolean |
processAll
|
protected Object |
value
|
Fields inherited from class org.eclipse.rse.ui.actions.SystemBaseAction |
---|
allowOnMultipleSelection, arrowCursor, helpId, selectionSensitive, shell, sSelection, traceSelections, traceTarget, viewer, waitCursor |
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 |
Constructor Summary | |
---|---|
protected |
SystemBaseDialogAction(String text,
ImageDescriptor image,
Shell shell)
Constructor for SystemBaseDialogAction when translated label is known. |
protected |
SystemBaseDialogAction(String text,
String tooltip,
ImageDescriptor image,
Shell shell)
Constructor for SystemBaseDialogAction when translated label and tooltip are known. |
protected |
SystemBaseDialogAction(String text,
String tooltip,
String description,
ImageDescriptor image,
Shell shell)
Constructor for SystemBaseDialogAction when translated label and tooltip and description are all known. |
Method Summary | |
---|---|
protected abstract Dialog |
createDialog(Shell parent)
If you decide to use the supplied run method as is, then you must override this method to create and return the dialog that is displayed by the default run method implementation. |
String |
getDialogHelpContextId()
Return the help Id destined for the dialog this action brings up |
protected abstract Object |
getDialogValue(Dialog dlg)
If you decide to use the supplied run method as is, then you must override this method to retrieve the data from the dialog. |
boolean |
getNeedsProgressMonitor()
Return true if the action's dialog/wizard is to include a progress monitor |
protected boolean |
getProcessAllSelections()
Return setting of setProcessAllSelections. |
Object |
getValue()
Get the value, typically set in actionPerformed after putting up the dialog, and holds the output from the dialog. |
void |
run()
This is the method called by the system when the user selects this action. |
void |
setDialogHelp(String id)
When using generic dialogs, it is nice to offer non-generic help. |
void |
setNeedsProgressMonitor(boolean needs)
If desired, specify if you want to include a progress monitor in your dialog or wizard. |
void |
setProcessAllSelections(boolean all)
If this action supports being enabled for multiple selections (the default, but changable by calling allowOnMultipleSelections(false)), then by default the default run() implementation will create and invoke the dialog once for each item selected. |
void |
setValue(Object value)
Set the value used as input to the dialog |
boolean |
wasCancelled()
Returns true if the user cancelled the dialog. |
protected boolean |
wasNeedsProgressMonitorSet()
Return true if the caller explicitly called setNeedsProgressMonitor |
Methods inherited from class org.eclipse.jface.action.AbstractAction |
---|
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener |
Methods inherited from class org.eclipse.core.commands.common.EventManager |
---|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject |
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, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText |
Methods inherited from interface org.eclipse.jface.viewers.ISelectionChangedListener |
---|
selectionChanged |
Field Detail |
---|
protected Object value
protected boolean processAll
protected boolean needsProgressMonitor
protected boolean needsProgressMonitorSet
protected boolean cancelled
protected String dlgHelpId
Constructor Detail |
---|
protected SystemBaseDialogAction(String text, ImageDescriptor image, Shell shell)
text
- string to display in menu or toolbarimage
- icon to display in menu or toolbar. Can be null.shell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.protected SystemBaseDialogAction(String text, String tooltip, ImageDescriptor image, Shell shell)
text
- string to display in menu or toolbartooltip
- string to display when user hovers mouse over action.image
- icon to display in menu or toolbar. Can be null.shell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.protected SystemBaseDialogAction(String text, String tooltip, String description, ImageDescriptor image, Shell shell)
text
- string to display in menu or toolbartooltip
- 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.shell
- Shell of parent window. Can be null if you don't know it, but call setShell when you do.Method Detail |
---|
public String getDialogHelpContextId()
public Object getValue()
getValue
in interface ISystemDialogAction
public boolean getNeedsProgressMonitor()
protected boolean wasNeedsProgressMonitorSet()
protected boolean getProcessAllSelections()
setProcessAllSelections(boolean)
public boolean wasCancelled()
wasCancelled
in interface ISystemDialogAction
public void setDialogHelp(String id)
public void setValue(Object value)
setValue
in interface ISystemDialogAction
public void setNeedsProgressMonitor(boolean needs)
public void setProcessAllSelections(boolean all)
Use this when the dialog itself will process all selected items at once.
The default is false.
setProcessAllSelections
in interface ISystemDialogAction
public void run()
Please note that if NO ITEMS are selected, we will still call createDialog but not call setInput.
To use this default implementation you must implement the createDialog method. Note we will also call dlg.setBlockOnOpen(true) on the returned dialog to force it to be modal.
run
in interface IAction
run
in class SystemBaseAction
Action.run()
protected abstract Dialog createDialog(Shell parent)
If you override actionPerformed with your own, then simply implement this to return null as it won't be used.
run()
protected abstract Object getDialogValue(Dialog dlg)
This is called by the run method after the dialog returns, and wasCancelled() is false. Callers of this object can subsequently retrieve this returned value by calling getValue. If you don't need to pass a value back to the caller of this action, simply return null from this method.
dlg
- The dialog object, after it has returned from open.
|
RSE Release 3.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |