com.ibm.carma.ui.action.custom
Class CustomActionInputDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.TrayDialog
              extended by org.eclipse.jface.dialogs.TitleAreaDialog
                  extended by 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 Class Summary
 
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, Action action, CustomActionAccepter resource, CustomActionParameterManager manager)
          Instantiates a new custom action input dialog.
 
Method Summary
 java.lang.Object[] getParameters()
           
 boolean isNoPromptForTask()
           
 boolean isStoreValues()
           
 
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
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Constructor Detail

CustomActionInputDialog

public CustomActionInputDialog(org.eclipse.swt.widgets.Shell parentShell,
                               Action action,
                               CustomActionAccepter resource,
                               CustomActionParameterManager manager)
Instantiates a new custom action input dialog.

Parameters:
parentShell - the parent SWT shell
action - the Action for which input shall be provided by the user
resource - the resource that the action will be run against.
manager - the CustomActionParameterManager which holds the default values for this action
Method Detail

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