com.ibm.carma.ui.action.custom
Class CustomActionInputDialog
java.lang.Object
org.eclipse.jface.window.Window
org.eclipse.jface.dialogs.Dialog
org.eclipse.jface.dialogs.TrayDialog
org.eclipse.jface.dialogs.TitleAreaDialog
com.ibm.carma.ui.action.custom.CustomActionInputDialog
- All Implemented Interfaces:
- org.eclipse.jface.window.IShellProvider
public class CustomActionInputDialog
- extends org.eclipse.jface.dialogs.TitleAreaDialog
This dialog is designed to query users for the input to a given action. This
dialog is designed to replace the deprecated CustomActionParameterDialog.
Here is an example of how this class can be used:
if (manager.isPromptNeeded(resource, actionId)) {
//find the action & then prompt the user
final Action action = resource.findActionFor(actionId);
if (action == null) { //this means that there is nothing special about this action
resource.performAction(actionId, monitor, null);
return;
}
Display.getDefault().syncExec(new Runnable(){
public void run() {
CustomActionInputDialog dialog = new CustomActionInputDialog(
Display.getDefault().getActiveShell(), null, action, resource, manager);
dialog.open();
if (dialog.getReturnCode() == 0) {
promptResults = dialog.getParameters();
} else {
promptResults = null;
}
}});
if (promptResults != null)
resource.performAction(actionId, monitor, promptResults);
else
; //do nothing, we've been cancelled
}
This Class does not check the passed in manager to see if it should prompt, rather it always
prompts, assuming the caller knows what he or she is doing. The manager however is queried to
provide the default values displayed in the prompt. Those values will be set to the results
intermingled with any values the user set. Constant parameters are not displayed.
- Since:
- 8.0
- See Also:
CustomActionUtil,
CustomActionParameterManager
| Nested classes/interfaces inherited from class org.eclipse.jface.window.Window |
org.eclipse.jface.window.Window.IExceptionHandler |
|
Field Summary |
static java.lang.String |
COPYRIGHT
|
| Fields inherited from class org.eclipse.jface.dialogs.TitleAreaDialog |
DLG_IMG_TITLE_BANNER, DLG_IMG_TITLE_ERROR, INFO_MESSAGE, WARNING_MESSAGE |
| Fields inherited from class org.eclipse.jface.dialogs.Dialog |
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS |
| Fields inherited from class org.eclipse.jface.window.Window |
CANCEL, OK |
|
Constructor Summary |
CustomActionInputDialog(org.eclipse.swt.widgets.Shell parentShell,
com.ibm.carma.model.Action action,
com.ibm.carma.model.CustomActionAccepter resource,
CustomActionParameterManager manager)
Instantiates a new custom action input dialog. |
| Methods inherited from class org.eclipse.jface.dialogs.TitleAreaDialog |
getErrorMessage, getMessage, setErrorMessage, setMessage, setMessage, setTitle, setTitleAreaColor, setTitleImage |
| Methods inherited from class org.eclipse.jface.dialogs.TrayDialog |
close, closeTray, getTray, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable |
| Methods inherited from class org.eclipse.jface.dialogs.Dialog |
applyDialogFont, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, create, getBlockedHandler, getImage, setBlockedHandler, shortenText |
| Methods inherited from class org.eclipse.jface.window.Window |
getDefaultImage, getDefaultImages, getDefaultOrientation, getReturnCode, getShell, getWindowManager, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setWindowManager |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT
public static final java.lang.String COPYRIGHT
- See Also:
- Constant Field Values
CustomActionInputDialog
public CustomActionInputDialog(org.eclipse.swt.widgets.Shell parentShell,
com.ibm.carma.model.Action action,
com.ibm.carma.model.CustomActionAccepter resource,
CustomActionParameterManager manager)
- Instantiates a new custom action input dialog.
- Parameters:
parentShell - the parent SWT shellaction - the Action for which input shall be provided by the userresource - the resource that the action will be run against.manager - the CustomActionParameterManager which holds the default values for this action
getParameters
public java.lang.Object[] getParameters()
- Returns:
- an Object[] filled with parameters, suitable for passing to an action,
or
null if the user cancelled
isStoreValues
public boolean isStoreValues()
- Returns:
- true if the user wants to store these results, false otherwise
isNoPromptForTask
public boolean isNoPromptForTask()
- Returns:
- true if the user does not want to be prompted again during this task, false otherwise