Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui.dialogs
Class SystemPromptDialog


java.lang.Object
  extended by 

org.eclipse.jface.window.Window
      extended by 

org.eclipse.jface.dialogs.Dialog
          extended by 
org.eclipse.rse.ui.dialogs.SystemPromptDialog
All Implemented Interfaces:
Runnable, IDialogPage, IRunnableContext, IShellProvider, ISystemPromptDialog, ISystemMessageLine, Listener
Direct Known Subclasses:
EnvironmentVariablesPromptDialog, SystemChangeFilterDialog, SystemChangePasswordDialog, SystemPasswordPersistencePrompt, SystemPasswordPromptDialog, SystemPromptForHomeFolderDialog, SystemRemoteResourceDialog, SystemRenameSingleDialog, SystemSelectAnythingDialog, SystemSelectFileTypesDialog, SystemSimpleCopyDialog, SystemSimpleSelectDialog

public abstract class SystemPromptDialog
extends Dialog
implements Listener, ISystemPromptDialog, ISystemMessageLine, IDialogPage, IRunnableContext, Runnable

Base dialog class. Use this whenever more than a simple string prompt is needed (which InputDialog gives you).

By default we configure the dialog as modal. If you do not want this, call setBlockOnOpen(false) after instantiating.

This base class offers the following ease-of-use features:

  • automatic support for typical buttons OK, Browse and Cancel.
    • just override the processOk, processBrowse and processCancel methods to process them
    • constructor option whether to enable Browse or not
    • ability to override default labels for all three.
  • automatic support for a message line
    • can turn it off
    • methods for writing messages to the message line
  • override just one method (createInner) to populate the client area
  • support for automatically assigning unique mnemonics to all buttons
    • easier to code, easier to translate
    • this is always done for you, so do not put your own mnemonics in your button text!
  • support for an input object for change mode vs "new" mode:
    • in change mode, callers pass this in via ctor or setInputObject method
    • in your child class, get it via inherited getInputObject and cast to what it is you are expecting
  • support for output object:
    • when ok pressed, built up the output object and then call inherited setOutputObject object method
    • dialog callers can then retrieve it via getOuputObject method.
  • support for wasCancelled() method so callers can easily determine how user exited the dialog
  • special affinity if you use an imbedded WorkWith widget:
    • call WorkWith's setPromptDialog(this) method to tell it the parent dialog is a PromptDialog
    • WorkWith widget will use PromptDialog's message line vs its own
    • WorkWith widget will know how to reassign mnemonics for its buttons when style is switched.
  • optional support (mri) for additional buttons (which your code handles):
    • Add
    • Browse
    • Test
    • Details>>
  • optional support for a built-in progress monitor just like wizards have. Call setNeedsProgressMonitor(boolean)
  • a simple setBusyCursor(boolean) method to toggle the cursor between busy and normal

To use this class:

  1. Subclass it, specifying the dialog title in the constructor. Optionally, also call setHelp(String) to set the dialog's help in the constructor.
  2. Override createInner(Composite) to populate the contents
  3. Override processOK() to process the pressing of the OK button

For error checking, add modify listeners to entry fields and if needed selection listeners to buttons, then in your event handler

  1. Call setErrorMessage(SystemMessage) to display an error if detected. Pass null to clear previous error.
  2. Call setPageComplete(boolean) with true if there are no errors and all required data is supplied. This enables/disables OK.
  3. The same two error-reporting strategies described in AbstractSystemWizardPage apply here.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window. Window
Window.IExceptionHandler
 
Field Summary
protected  long activeRunningOperations
           
protected static boolean ADD_BUTTON_NO
           
protected static boolean ADD_BUTTON_YES
           
protected static int ADD_ID
           
protected   Button addButton
           
protected   Cursor arrowCursor
           
protected static boolean BROWSE_BUTTON_NO
           
protected static boolean BROWSE_BUTTON_YES
           
protected static int BROWSE_ID
           
protected   Button browseButton
           
protected   Composite buttonsComposite
           
protected static int CANCEL_ALL_ID
           
protected   Button cancelAllButton
           
protected  boolean cancelAllPressed
           
protected   Button cancelButton
           
protected   SelectionAdapter cancelListener
           
protected static boolean DETAILS_BUTTON_NO
           
protected static boolean DETAILS_BUTTON_YES
           
protected static int DETAILS_ID
           
protected   Button detailsButton
           
protected  boolean detailsButtonHideMode
           
protected   String detailsHideLabel
           
protected   String detailsShowLabel
           
protected   Composite dialogAreaComposite
           
protected   Mnemonics dialogMnemonics
           
protected   SystemMessageLine fMessageLine
           
protected   String helpId
           
protected  int horizontalSpacing
           
protected  boolean initialAddButtonEnabledState
           
protected  boolean initialDetailsButtonEnabledState
           
protected  boolean initialOKButtonEnabledState
           
protected   Object inputObject
           
protected   String labelAdd
           
protected   String labelBrowse
           
protected   String labelCancel
           
protected   String labelCancelAll
           
protected   String labelDetailsHide
           
protected   String labelDetailsShow
           
protected   String labelOk
           
protected   String labelTest
           
protected  int marginHeight
           
protected  int marginWidth
           
protected  int minHeight
           
protected  int minWidth
           
protected  boolean needsProgressMonitor
           
protected   Button noShowAgainButton
           
protected  boolean noShowAgainOption
           
protected   Button okButton
           
protected  boolean okPressed
           
protected  boolean operationCancelableState
           
protected   Object outputObject
           
protected   ISystemValidator outputObjectValidator
           
protected   Shell overallShell
           
protected  boolean pack
           
protected   Composite parentComposite
           
protected   SystemMessage pendingErrorMessage
           
protected   SystemMessage pendingMessage
           
protected   String prefId
           
protected   IPreferenceStore prefStore
           
protected  boolean prefValAsSelected
           
protected   ProgressMonitorPart progressMonitorPart
           
protected  boolean showAddButton
           
protected  boolean showBrowseButton
           
protected  boolean showCancelAllButton
           
protected  boolean showDetailsButton
           
protected  boolean showOkButton
           
protected  boolean showTestButton
           
protected static boolean TEST_BUTTON_NO
           
protected static boolean TEST_BUTTON_YES
           
protected static int TEST_ID
           
protected   Button testButton
           
protected   String tipAdd
           
protected   String tipBrowse
           
protected   String tipCancel
           
protected   String tipCancelAll
           
protected   String tipDetailsHide
           
protected   String tipDetailsShow
           
protected   String tipOk
           
protected   String tipTest
           
protected   String title
           
protected   Image titleImage
           
protected  int verticalSpacing
           
protected   Cursor waitCursor
           
protected   MessageDialog windowClosingDialog
           
 
Fields inherited from class org.eclipse.jface.dialogs. Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, 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
SystemPromptDialog ( Shell shell, String title)
          Constructor one: ok and cancel buttons
SystemPromptDialog ( Shell shell, String title, boolean browse)
          Constructor four: ok, browse and cancel buttons
SystemPromptDialog ( Shell shell, String title, Image titleImage)
          Constructor two: ok and cancel buttons and an icon for the dialog title area
SystemPromptDialog ( Shell shell, String title, Object inputObject)
          Constructor three: ok and cancel buttons, plus explicit setting of input object
SystemPromptDialog ( Shell shell, String title, Object inputObject, boolean browse)
          Constructor five: ok, browse and cancel buttons, plus explicit setting of input object
SystemPromptDialog ( Shell shell, String title, Object inputObject, boolean browse, boolean test, Image titleImage)
          Constructor six: an input object. true/false for browse button, true/false for test button, a title image
SystemPromptDialog ( Shell shell, String title, Object inputObject, boolean browse, Image titleImage)
          Constructor six: ok, browse and cancel buttons, plus explicit setting of input object and an icon for the dialog title area
 
Method Summary
protected   Object aboutToStart (boolean enableCancelButton)
          About to start a long running operation tiggered through the dialog.
protected   Label addFillerLine ( Composite parent, int nbrColumns)
          Add a spacer line
protected   Label addGrowableFillerLine ( Composite parent, int nbrColumns)
          Add a spacer line that grows in height to absorb extra space
protected   Label addSeparatorLine ( Composite parent, int nbrColumns)
          Add a separator line.
protected  void adjustButtonWidth ( Button button)
          Adjust the width hint of a button to account for the presumed addition of a mnemonic.
protected  void applyMnemonics ( Mnemonics mnemonics, Composite c)
          Apply mnemonic to the composite.
protected  void buttonPressed (int buttonId)
          Override of parent method.
 void clearErrorMessage ()
          Clears the currently displayed error message and redisplayes the message which was active before the error message was set.
 void clearMessage ()
          Clears the currently displayed message.
 boolean close ()
           
protected  void configureShell ( Shell shell)
           
protected   Control createButtonBar ( Composite parent)
          Intercept of parent, so we can create the msg line above the button bar.
protected  void createButtonsForButtonBar ( Composite parent)
          Add buttons to the dialog's button bar.
protected   Control createContents ( Composite parent)
          Override of parent.
 void createControl ( Composite parent)
           
protected   Control createDialogArea ( Composite parent)
          Called by parent.
protected abstract   Control createInner ( Composite parent)
          Called by createContents method.
protected   ISystemMessageLine createMessageLine ( Composite c)
          Create message line.
protected   Button createNoShowAgainButton ( Composite c)
          Creates a button to allow option to not show this dialog again.
protected   MessageDialog createWizardClosingDialog ()
          Creates and returns a new wizard closing dialog without opening it.
 void dispose ()
           
 void enableAddButton (boolean enable)
          For explicitly enabling/disabling Add button.
 void enableBrowseButton (boolean enable)
          For explicitly enabling/disabling Browse button.
 void enableCancelAllButton (boolean enable)
          For explicitly enabling/disabling cancel button.
 void enableCancelButton (boolean enable)
          For explicitly enabling/disabling cancel button.
 void enableDetailsButton (boolean enable)
          For explicitly enabling/disabling Details button.
 void enableOkButton (boolean enable)
          For explicitly enabling/disabling ok button.
 void enableTestButton (boolean enable)
          For explicitly enabling/disabling Test button.
  Button getAddButton ()
          Return Add button widget
  Button getBrowseButton ()
          Return browse button widget
  Button getCancelAllButton ()
          Return cancel button widget.
  Button getCancelOrCloseButton ()
          Return cancel button widget.
  Control getControl ()
           
  String getDescription ()
           
  Button getDetailsButton ()
          Return Details button widget
  Mnemonics getDialogMnemonics ()
          Get the list of all unique mnemonics used by buttons on this dialog.
  String getErrorMessage ()
          Get the currently displayed error text.
  String getHelpContextId ()
          For retrieving the help Id
  Image getImage ()
           
protected abstract   Control getInitialFocusControl ()
          Return the Control to be given initial focus.
  Object getInputObject ()
          For explicitly getting input object
  String getMessage ()
          Get the currently displayed message.
  ISystemMessageLine getMessageLine ()
          Get the ISystemMessageLine control reference.
  Button getOkButton ()
          Return ok button widget
  Object getOutputObject ()
          For explicitly getting output object after dialog is dismissed.
  ICellEditorValidator getOutputObjectValidator ()
          Return the output object validator
  IProgressMonitor getProgressMonitor ()
          Returns the progress monitor for this dialog (if it has one).
  SystemMessage getSystemErrorMessage ()
          Get the currently displayed error text.
  Button getTestButton ()
          Return test button widget
  String getTitle ()
          Get the dialog's title
 void handleEvent ( Event e)
          Handles events generated by controls on this page.
protected  boolean hardClose ()
          Closes this window.
protected  boolean okToClose ()
          Checks whether it is alright to close this wizard dialog and perform standard cancel processing.
 void performHelp ()
           
protected  boolean processAdd ()
          To be overridden by children.
protected  boolean processBrowse ()
          To be overridden by children.
protected  boolean processCancel ()
          To be overridden by children.
protected  boolean processCancelAll ()
          To be overridden by children.
protected  boolean processDetails (boolean hideMode)
          To be overridden by children.
protected  boolean processOK ()
          To be overridden by children.
protected  boolean processTest ()
          To be overridden by children.
 int publicConvertHeightInCharsToPixels (int chars)
          Expose inherited protected method convertHeightInCharsToPixels as a publicly excessible method
 int publicConvertWidthInCharsToPixels (int chars)
          Expose inherited protected method convertWidthInCharsToPixels as a publicly excessible method
protected  void restoreEnableState ( Control w, Map h, String key)
          Restores the enabled/disabled state of the given control.
protected  void restoreUIState ( Map state)
          Restores the enabled/disabled state of the wizard dialog's buttons and the tree of controls for the currently showing page.
 void run ()
          For asynch exec we defer some operations until other pending events are processed.
 void run (boolean fork, boolean cancelable, IRunnableWithProgress runnable)
          For IRunnableContext.
protected  void saveEnableStateAndSet ( Control w, Map h, String key, boolean enabled)
          Saves the enabled/disabled state of the given control in the given map, which must be modifiable.
protected   Map saveUIState (boolean keepCancelEnabled)
          Captures and returns the enabled/disabled state of the wizard dialog's buttons and the tree of controls for the currently showing page.
 void setAddButtonLabel ( String label)
          For explicitly setting Add button label
 void setAddButtonToolTipText ( String tip)
          For explicitly setting Add button tooltip text
 void setBrowseButtonLabel ( String label)
          For explicitly setting browse button label
 void setBrowseButtonToolTipText ( String tip)
          For explicitly setting Browse button tooltip text
 void setBusyCursor (boolean setBusy)
          Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).
 void setCancelAllButtonLabel ( String label)
          For explicitly setting cancel button label
 void setCancelAllButtonToolTipText ( String tip)
          For explicitly setting cancel button tooltip text
 void setCancelButtonLabel ( String label)
          For explicitly setting cancel button label
 void setCancelButtonToolTipText ( String tip)
          For explicitly setting cancel button tooltip text
 void setControl ( Control c)
           
 void setDescription ( String description)
           
 void setDetailsButtonLabel ( String showLabel, String hideLabel)
          For explicitly setting Details button label
 void setDetailsButtonToolTipText ( String showTip, String hideTip)
          For explicitly setting Details button tooltip text
protected  void setDisplayCursor ( Cursor c)
          Sets the given cursor for all shells currently active for this window's display.
static void setDisplayCursor ( Shell shell, Cursor c)
          Sets the given cursor for all shells currently active for the given shell's display.
 void setErrorMessage ( String message)
          Display the given error message.
 void setErrorMessage ( SystemMessage message)
          Display the given error message.
 void setErrorMessage ( Throwable exc)
          Convenience method to set an error message from an exception
 void setHelp ( Control c, String helpId)
          For setting control-specific help for a control on the wizard page.
 void setHelp ( String helpId)
          For setting the default overall help for the dialog.
 void setImageDescriptor ( ImageDescriptor id)
           
 void setInitialOKButtonEnabledState (boolean enabled)
          Set initial enabled state of ok button.
 void setInputObject ( Object inputObject)
          For explicitly setting input object
 void setMessage ( String message)
          Set the message text.
 void setMessage ( SystemMessage message)
          If the message line currently displays an error, the message is stored and will be shown after a call to clearErrorMessage
 void setMinimumSize (int width, int height)
          Set minimum width and height for this dialog.
 void setNeedsProgressMonitor (boolean needs)
          Specify if a progress monitor is desired in this dialog.
 void setNoShowAgainOption (boolean noShowAgainOption, IPreferenceStore prefStore, String prefId, boolean prefValAsSelected)
          Set option to not show this dialog again and specify the preference that should be set according to whether the user selects to show the dialog again or no.
 void setOkButtonLabel ( String label)
          For explicitly setting ok button label
 void setOkButtonToolTipText ( String tip)
          For explicitly setting ok button tooltip text
 void setOutputObject ( Object outputObject)
          For explicitly setting output object after wizard is dismissed.
 void setOutputObjectValidator ( ISystemValidator outputObjectValidator)
          If validation of the output object is desired, set the validator here.
 void setPageComplete (boolean complete)
          Call this to disable the Apply button if the input is not complete or not valid.
 void setShowAddButton (boolean show)
          Explicitly specify if Add Button to be shown
 void setShowBrowseButton (boolean show)
          Explicitly specify if Browse Button to be shown
 void setShowCancelAllButton (boolean showCancelAll)
          Enable or disable showing of Cancel All button
 void setShowDetailsButton (boolean show, boolean hideMode)
          Explicitly specify if Details Button to be shown.
 void setShowOkButton (boolean showOk)
          Disable showing of Ok button
 void setShowTestButton (boolean show)
          Explicitly specify if Test Button to be shown
 void setTestButtonLabel ( String label)
          For explicitly setting test button label
 void setTestButtonToolTipText ( String tip)
          For explicitly setting Test button tooltip text
 void setTitle ( String title)
          Set the dialog's title
 void setVisible (boolean visible)
           
 boolean wasCancelled ()
          Allow caller to determine if window was cancelled or not.
 boolean wasCancelledAll ()
           
 
Methods inherited from class org.eclipse.jface.dialogs. Dialog
applyDialogFont, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getInitialSize, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window. Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

okPressed

protected boolean okPressed

cancelAllPressed

protected boolean cancelAllPressed

showBrowseButton

protected boolean showBrowseButton

showTestButton

protected boolean showTestButton

showAddButton

protected boolean showAddButton

showDetailsButton

protected boolean showDetailsButton

pack

protected boolean pack

initialOKButtonEnabledState

protected boolean initialOKButtonEnabledState

initialAddButtonEnabledState

protected boolean initialAddButtonEnabledState

initialDetailsButtonEnabledState

protected boolean initialDetailsButtonEnabledState

detailsButtonHideMode

protected boolean detailsButtonHideMode

showOkButton

protected boolean showOkButton

showCancelAllButton

protected boolean showCancelAllButton

overallShell

protected 
Shell overallShell

parentComposite

protected 
Composite parentComposite

dialogAreaComposite

protected 
Composite dialogAreaComposite

buttonsComposite

protected 
Composite buttonsComposite

okButton

protected 
Button okButton

cancelButton

protected 
Button cancelButton

cancelAllButton

protected 
Button cancelAllButton

testButton

protected 
Button testButton

browseButton

protected 
Button browseButton

addButton

protected 
Button addButton

detailsButton

protected 
Button detailsButton

title

protected 
String title

labelOk

protected 
String labelOk

labelBrowse

protected 
String labelBrowse

labelTest

protected 
String labelTest

labelCancel

protected 
String labelCancel

labelCancelAll

protected 
String labelCancelAll

labelAdd

protected 
String labelAdd

labelDetailsShow

protected 
String labelDetailsShow

labelDetailsHide

protected 
String labelDetailsHide

tipOk

protected 
String tipOk

tipBrowse

protected 
String tipBrowse

tipTest

protected 
String tipTest

tipCancel

protected 
String tipCancel

tipCancelAll

protected 
String tipCancelAll

tipAdd

protected 
String tipAdd

tipDetailsShow

protected 
String tipDetailsShow

tipDetailsHide

protected 
String tipDetailsHide

noShowAgainOption

protected boolean noShowAgainOption

noShowAgainButton

protected 
Button noShowAgainButton

detailsShowLabel

protected 
String detailsShowLabel

detailsHideLabel

protected 
String detailsHideLabel

helpId

protected 
String helpId

titleImage

protected 
Image titleImage

inputObject

protected 
Object inputObject

outputObject

protected 
Object outputObject

fMessageLine

protected 
SystemMessageLine fMessageLine

pendingMessage

protected 
SystemMessage pendingMessage

pendingErrorMessage

protected 
SystemMessage pendingErrorMessage

minWidth

protected int minWidth

minHeight

protected int minHeight

marginWidth

protected int marginWidth

marginHeight

protected int marginHeight

verticalSpacing

protected int verticalSpacing

horizontalSpacing

protected int horizontalSpacing

dialogMnemonics

protected 
Mnemonics dialogMnemonics

outputObjectValidator

protected 
ISystemValidator outputObjectValidator

activeRunningOperations

protected long activeRunningOperations

operationCancelableState

protected boolean operationCancelableState

needsProgressMonitor

protected boolean needsProgressMonitor

progressMonitorPart

protected 
ProgressMonitorPart progressMonitorPart

waitCursor

protected 
Cursor waitCursor

arrowCursor

protected 
Cursor arrowCursor

windowClosingDialog

protected 
MessageDialog windowClosingDialog

cancelListener

protected 
SelectionAdapter cancelListener

prefStore

protected 
IPreferenceStore prefStore

prefId

protected 
String prefId

prefValAsSelected

protected boolean prefValAsSelected

BROWSE_ID

protected static final int BROWSE_ID
See Also:
Constant Field Values

TEST_ID

protected static final int TEST_ID
See Also:
Constant Field Values

ADD_ID

protected static final int ADD_ID
See Also:
Constant Field Values

DETAILS_ID

protected static final int DETAILS_ID
See Also:
Constant Field Values

CANCEL_ALL_ID

protected static final int CANCEL_ALL_ID
See Also:
Constant Field Values

BROWSE_BUTTON_YES

protected static final boolean BROWSE_BUTTON_YES
See Also:
Constant Field Values

BROWSE_BUTTON_NO

protected static final boolean BROWSE_BUTTON_NO
See Also:
Constant Field Values

TEST_BUTTON_YES

protected static final boolean TEST_BUTTON_YES
See Also:
Constant Field Values

TEST_BUTTON_NO

protected static final boolean TEST_BUTTON_NO
See Also:
Constant Field Values

ADD_BUTTON_YES

protected static final boolean ADD_BUTTON_YES
See Also:
Constant Field Values

ADD_BUTTON_NO

protected static final boolean ADD_BUTTON_NO
See Also:
Constant Field Values

DETAILS_BUTTON_YES

protected static final boolean DETAILS_BUTTON_YES
See Also:
Constant Field Values

DETAILS_BUTTON_NO

protected static final boolean DETAILS_BUTTON_NO
See Also:
Constant Field Values
Constructor Detail

SystemPromptDialog

public SystemPromptDialog(
Shell shell,
                          
String title)
Constructor one: ok and cancel buttons

Parameters:
shell - - parent window this dialog is modal to.
title - - the title for the dialog. Typically translated.
See Also:
setInputObject(Object)

SystemPromptDialog

public SystemPromptDialog(
Shell shell,
                          
String title,
                          
Image titleImage)
Constructor two: ok and cancel buttons and an icon for the dialog title area

Parameters:
shell - - parent window this dialog is modal to.
title - - the title for the dialog. Typically translated.
titleImage - - the icon for the dialog's title area.
See Also:
setInputObject(Object)

SystemPromptDialog

public SystemPromptDialog(
Shell shell,
                          
String title,
                          
Object inputObject)
Constructor three: ok and cancel buttons, plus explicit setting of input object

Parameters:
shell - - parent window this dialog is modal to.
title - - the title for the dialog. Typically translated.
inputObject - - the contextual input data, which can be queried via getInputObject().

SystemPromptDialog

public SystemPromptDialog(
Shell shell,
                          
String title,
                          boolean browse)
Constructor four: ok, browse and cancel buttons

Parameters:
shell - - parent window this dialog is modal to.
title - - the title for the dialog. Typically translated.
browse - - true if to show a Browse button, false if no Browse button desired.
See Also:
setInputObject(Object)

SystemPromptDialog

public SystemPromptDialog(
Shell shell,
                          
String title,
                          
Object inputObject,
                          boolean browse)
Constructor five: ok, browse and cancel buttons, plus explicit setting of input object

Parameters:
shell - - parent window this dialog is modal to.
title - - the title for the dialog. Typically translated.
inputObject - - the contextual input data, which can be queried via getInputObject().
browse - - true if to show a Browse button, false if no Browse button desired.

SystemPromptDialog

public SystemPromptDialog(
Shell shell,
                          
String title,
                          
Object inputObject,
                          boolean browse,
                          
Image titleImage)
Constructor six: ok, browse and cancel buttons, plus explicit setting of input object and an icon for the dialog title area

Parameters:
shell - - parent window this dialog is modal to.
title - - the title for the dialog. Typically translated.
inputObject - - the contextual input data, which can be queried via getInputObject().
browse - - true if to show a Browse button, false if no Browse button desired.
titleImage - - the icon for the dialog's title area.

SystemPromptDialog

public SystemPromptDialog(
Shell shell,
                          
String title,
                          
Object inputObject,
                          boolean browse,
                          boolean test,
                          
Image titleImage)
Constructor six: an input object. true/false for browse button, true/false for test button, a title image

Method Detail

configureShell

protected void configureShell(
Shell shell)
Overrides:
configureShell in class Window

setNeedsProgressMonitor

public void setNeedsProgressMonitor(boolean needs)
Specify if a progress monitor is desired in this dialog. Should be called right after instantiation. The default is false. If true is specified, area on the dialog is reserved for the progress monitor, and the monitor can be retrieved via getProgressMonitor().

Support is patterned after WizardDialog in JFace.


setHelp

public void setHelp(
String helpId)
For setting the default overall help for the dialog. This can be overridden per control by calling setHelp(Control, String).


getHelpContextId

public 
String getHelpContextId()
For retrieving the help Id


setHelp

public void setHelp(
Control c,
                    
String helpId)
For setting control-specific help for a control on the wizard page.

This overrides the default set in the call to setHelp(String).


setInputObject

public void setInputObject(
Object inputObject)
Description copied from interface: ISystemPromptDialog
For explicitly setting input object

Specified by:
setInputObject in interface ISystemPromptDialog

getInputObject

public 
Object getInputObject()
Description copied from interface: ISystemPromptDialog
For explicitly getting input object

Specified by:
getInputObject in interface ISystemPromptDialog

getOutputObject

public 
Object getOutputObject()
Description copied from interface: ISystemPromptDialog
For explicitly getting output object after dialog is dismissed. Set by the dialog's processOK method.

Specified by:
getOutputObject in interface ISystemPromptDialog

wasCancelled

public boolean wasCancelled()
Description copied from interface: ISystemPromptDialog
Allow caller to determine if window was cancelled or not.

Specified by:
wasCancelled in interface ISystemPromptDialog

wasCancelledAll

public boolean wasCancelledAll()

setOutputObjectValidator

public void setOutputObjectValidator(
ISystemValidator outputObjectValidator)
If validation of the output object is desired, set the validator here. It will be used when the child class calls setOutputObject().


getOutputObjectValidator

public 
ICellEditorValidator getOutputObjectValidator()
Return the output object validator


getMessageLine

public 
ISystemMessageLine getMessageLine()
Get the ISystemMessageLine control reference.


setOutputObject

public void setOutputObject(
Object outputObject)
Description copied from interface: ISystemPromptDialog
For explicitly setting output object after wizard is dismissed. Called in the wizard's processFinish method, typically.

Specified by:
setOutputObject in interface ISystemPromptDialog

setBusyCursor

public void setBusyCursor(boolean setBusy)
Set the cursor to the wait cursor (true) or restores it to the normal cursor (false).


setShowOkButton

public void setShowOkButton(boolean showOk)
Disable showing of Ok button


setOkButtonLabel

public void setOkButtonLabel(
String label)
For explicitly setting ok button label


setOkButtonToolTipText

public void setOkButtonToolTipText(
String tip)
For explicitly setting ok button tooltip text


enableOkButton

public void enableOkButton(boolean enable)
For explicitly enabling/disabling ok button.


getOkButton

public 
Button getOkButton()
Return ok button widget


setInitialOKButtonEnabledState

public void setInitialOKButtonEnabledState(boolean enabled)
Set initial enabled state of ok button. Call this from createContents, which is called before the ok button is created.


processOK

protected boolean processOK()
To be overridden by children. Called when user presses OK button. Child dialog class should set output object. Return true to close dialog. Return false to not close dialog.


setCancelButtonLabel

public void setCancelButtonLabel(
String label)
For explicitly setting cancel button label


setCancelButtonToolTipText

public void setCancelButtonToolTipText(
String tip)
For explicitly setting cancel button tooltip text


enableCancelButton

public void enableCancelButton(boolean enable)
For explicitly enabling/disabling cancel button.


getCancelOrCloseButton

public 
Button getCancelOrCloseButton()
Return cancel button widget. Be careful not to call the deprecated inherited method getCancelButton()!


processCancel

protected boolean processCancel()
To be overridden by children. Called when user presses CANCEL button. Return true to close dialog. Return false to not close dialog.


setShowCancelAllButton

public void setShowCancelAllButton(boolean showCancelAll)
Enable or disable showing of Cancel All button


setCancelAllButtonLabel

public void setCancelAllButtonLabel(
String label)
For explicitly setting cancel button label


setCancelAllButtonToolTipText

public void setCancelAllButtonToolTipText(
String tip)
For explicitly setting cancel button tooltip text


enableCancelAllButton

public void enableCancelAllButton(boolean enable)
For explicitly enabling/disabling cancel button.


getCancelAllButton

public 
Button getCancelAllButton()
Return cancel button widget. Be careful not to call the deprecated inherited method getCancelButton()!


processCancelAll

protected boolean processCancelAll()
To be overridden by children. Called when user presses CANCEL button. Return true to close dialog. Return false to not close dialog.


setShowBrowseButton

public void setShowBrowseButton(boolean show)
Explicitly specify if Browse Button to be shown


setBrowseButtonLabel

public void setBrowseButtonLabel(
String label)
For explicitly setting browse button label


setBrowseButtonToolTipText

public void setBrowseButtonToolTipText(
String tip)
For explicitly setting Browse button tooltip text


enableBrowseButton

public void enableBrowseButton(boolean enable)
For explicitly enabling/disabling Browse button.


getBrowseButton

public 
Button getBrowseButton()
Return browse button widget


processBrowse

protected boolean processBrowse()
To be overridden by children. Called when user presses BROWSE button. Return false always!


setShowTestButton

public void setShowTestButton(boolean show)
Explicitly specify if Test Button to be shown


setTestButtonLabel

public void setTestButtonLabel(
String label)
For explicitly setting test button label


setTestButtonToolTipText

public void setTestButtonToolTipText(
String tip)
For explicitly setting Test button tooltip text


enableTestButton

public void enableTestButton(boolean enable)
For explicitly enabling/disabling Test button.


getTestButton

public 
Button getTestButton()
Return test button widget


processTest

protected boolean processTest()
To be overridden by children. Called when user presses TEST button. Return false always!


setShowAddButton

public void setShowAddButton(boolean show)
Explicitly specify if Add Button to be shown


setAddButtonLabel

public void setAddButtonLabel(
String label)
For explicitly setting Add button label


setAddButtonToolTipText

public void setAddButtonToolTipText(
String tip)
For explicitly setting Add button tooltip text


enableAddButton

public void enableAddButton(boolean enable)
For explicitly enabling/disabling Add button.


getAddButton

public 
Button getAddButton()
Return Add button widget


processAdd

protected boolean processAdd()
To be overridden by children. Called when user presses ADD button. Return false always!


setShowDetailsButton

public void setShowDetailsButton(boolean show,
                                 boolean hideMode)
Explicitly specify if Details Button to be shown. There is support to automatically toggle the text.

Parameters:
show - if the Details button is to be shown
hideMode - if the button should initially be in "hide mode" versus "hide mode"

setDetailsButtonLabel

public void setDetailsButtonLabel(
String showLabel,
                                  
String hideLabel)
For explicitly setting Details button label


setDetailsButtonToolTipText

public void setDetailsButtonToolTipText(
String showTip,
                                        
String hideTip)
For explicitly setting Details button tooltip text


enableDetailsButton

public void enableDetailsButton(boolean enable)
For explicitly enabling/disabling Details button.


getDetailsButton

public 
Button getDetailsButton()
Return Details button widget


processDetails

protected boolean processDetails(boolean hideMode)
To be overridden by children. Called when user presses DETAILS button.

Note the text is automatically toggled for you! You need only do whatever the functionality is that you desire

Parameters:
hideMode - the current state of the details toggle, prior to this request. If you return true from this method, this state and the button text will be toggled.
Returns:
true if the details state toggle was successful, false if it failed.

getDialogMnemonics

public 
Mnemonics getDialogMnemonics()
Get the list of all unique mnemonics used by buttons on this dialog. This is only set at the time createButtonBar is called by the parent, and this is after the createContents method call. It will return null until then. So, it is not available for you at constructor time. Use setUniqueMnemonic(Button) on the returned object if you want to add a mnemonic to button after the fact.


createMessageLine

protected 
ISystemMessageLine createMessageLine(
Composite c)
Create message line.


run

public void run()
For asynch exec we defer some operations until other pending events are processed. For now, this is used to display pending error messages

Specified by:
run in interface Runnable

handleEvent

public void handleEvent(
Event e)
Handles events generated by controls on this page. Should be overridden by child. Only public because of interface requirement!

Specified by:
handleEvent in interface Listener

createInner

protected abstract 
Control createInner(
Composite parent)
Called by createContents method. Create this dialog's widgets inside a composite. Child classes must override this.


getInitialFocusControl

protected abstract 
Control getInitialFocusControl()
Return the Control to be given initial focus. Child classes must override this, but can return null.


buttonPressed

protected void buttonPressed(int buttonId)
Override of parent method. Called by IDE when button is pressed.

Overrides:
buttonPressed in class Dialog

createButtonBar

protected 
Control createButtonBar(
Composite parent)
Intercept of parent, so we can create the msg line above the button bar.

Overrides:
createButtonBar in class Dialog

adjustButtonWidth

protected void adjustButtonWidth(
Button button)
Adjust the width hint of a button to account for the presumed addition of a mnemonic.

Parameters:
button - the button whose width is to be adjusted.

createButtonsForButtonBar

protected void createButtonsForButtonBar(
Composite parent)
Add buttons to the dialog's button bar. Subclasses may override.

Overrides:
createButtonsForButtonBar in class Dialog
Parameters:
parent - the button bar composite

setMinimumSize

public void setMinimumSize(int width,
                           int height)
Set minimum width and height for this dialog. Pass zero for either to not affect it.


createContents

protected 
Control createContents(
Composite parent)
Override of parent.

Overrides:
createContents in class Dialog

applyMnemonics

protected void applyMnemonics(
Mnemonics mnemonics,
                              
Composite c)
Apply mnemonic to the composite.

Parameters:
c - the composite.

createDialogArea

protected 
Control createDialogArea(
Composite parent)
Called by parent. Create overall dialog page layout.

Overrides:
createDialogArea in class Dialog

setNoShowAgainOption

public void setNoShowAgainOption(boolean noShowAgainOption,
                                 
IPreferenceStore prefStore,
                                 
String prefId,
                                 boolean prefValAsSelected)
Set option to not show this dialog again and specify the preference that should be set according to whether the user selects to show the dialog again or no. The caller can query this preference to find out what the user selection is.

Parameters:
noShowAgainOption - true to show the option in the dialog, false to not show it.
prefStore - the preference store.
prefId - the preference id for which a boolean value will be stored according to the user's selection.
prefValAsSelected - whether to mirror the user selection in the preference. If this is set to true, then the value stored in the preference is true if the user selects the option, and false if the user does not select the option. If this is set to false, then the value stored in the preference will be false if the user selects the option, and true if the user does not select the option

createNoShowAgainButton

protected 
Button createNoShowAgainButton(
Composite c)
Creates a button to allow option to not show this dialog again.

Returns:
the button that allows option to not show this dialog again.

setPageComplete

public void setPageComplete(boolean complete)
Call this to disable the Apply button if the input is not complete or not valid.


addSeparatorLine

protected 
Label addSeparatorLine(
Composite parent,
                                 int nbrColumns)
Add a separator line. This is a physically visible line.


addFillerLine

protected 
Label addFillerLine(
Composite parent,
                              int nbrColumns)
Add a spacer line


addGrowableFillerLine

protected 
Label addGrowableFillerLine(
Composite parent,
                                      int nbrColumns)
Add a spacer line that grows in height to absorb extra space


publicConvertWidthInCharsToPixels

public int publicConvertWidthInCharsToPixels(int chars)
Expose inherited protected method convertWidthInCharsToPixels as a publicly excessible method

Specified by:
publicConvertWidthInCharsToPixels in interface ISystemPromptDialog

publicConvertHeightInCharsToPixels

public int publicConvertHeightInCharsToPixels(int chars)
Expose inherited protected method convertHeightInCharsToPixels as a publicly excessible method

Specified by:
publicConvertHeightInCharsToPixels in interface ISystemPromptDialog

clearErrorMessage

public void clearErrorMessage()
Clears the currently displayed error message and redisplayes the message which was active before the error message was set.

Specified by:
clearErrorMessage in interface ISystemMessageLine

clearMessage

public void clearMessage()
Clears the currently displayed message.

Specified by:
clearMessage in interface ISystemMessageLine

getErrorMessage

public 
String getErrorMessage()
Get the currently displayed error text.

Specified by:
getErrorMessage in interface IDialogPage
Specified by:
getErrorMessage in interface ISystemMessageLine
Returns:
The error message. If no error message is displayed null is returned.

getSystemErrorMessage

public 
SystemMessage getSystemErrorMessage()
Get the currently displayed error text.

Specified by:
getSystemErrorMessage in interface ISystemMessageLine
Returns:
The error message. If no error message is displayed null is returned.

getMessage

public 
String getMessage()
Get the currently displayed message.

Specified by:
getMessage in interface IDialogPage
Specified by:
getMessage in interface ISystemMessageLine
Returns:
The message. If no message is displayed null is returned.

setErrorMessage

public void setErrorMessage(
String message)
Display the given error message. A currently displayed message is saved and will be redisplayed when the error message is cleared.

Specified by:
setErrorMessage in interface ISystemMessageLine

setErrorMessage

public void setErrorMessage(
SystemMessage message)
Display the given error message. A currently displayed message is saved and will be redisplayed when the error message is cleared.

Specified by:
setErrorMessage in interface ISystemMessageLine

setMessage

public void setMessage(
String message)
Set the message text. If the message line currently displays an error, the message is stored and will be shown after a call to clearErrorMessage

Specified by:
setMessage in interface ISystemMessageLine

setMessage

public void setMessage(
SystemMessage message)
If the message line currently displays an error, the message is stored and will be shown after a call to clearErrorMessage

Specified by:
setMessage in interface ISystemMessageLine

setErrorMessage

public void setErrorMessage(
Throwable exc)
Convenience method to set an error message from an exception

Specified by:
setErrorMessage in interface ISystemMessageLine

setDescription

public void setDescription(
String description)
Specified by:
setDescription in interface IDialogPage

getDescription

public 
String getDescription()
Specified by:
getDescription in interface IDialogPage

getImage

public 
Image getImage()
Specified by:
getImage in interface IDialogPage

performHelp

public void performHelp()
Specified by:
performHelp in interface IDialogPage

setVisible

public void setVisible(boolean visible)
Specified by:
setVisible in interface IDialogPage

dispose

public void dispose()
Specified by:
dispose in interface IDialogPage

getControl

public 
Control getControl()
Specified by:
getControl in interface IDialogPage

setControl

public void setControl(
Control c)

createControl

public void createControl(
Composite parent)
Specified by:
createControl in interface IDialogPage

setImageDescriptor

public void setImageDescriptor(
ImageDescriptor id)
Specified by:
setImageDescriptor in interface IDialogPage

getTitle

public 
String getTitle()
Get the dialog's title

Specified by:
getTitle in interface IDialogPage

setTitle

public void setTitle(
String title)
Set the dialog's title

Specified by:
setTitle in interface IDialogPage

getProgressMonitor

public 
IProgressMonitor getProgressMonitor()
Returns the progress monitor for this dialog (if it has one).

Returns:
the progress monitor, or null if this dialog does not have one

aboutToStart

protected 
Object aboutToStart(boolean enableCancelButton)
About to start a long running operation tiggered through the dialog. Shows the progress monitor and disables the dialog's buttons and controls.

Parameters:
enableCancelButton - true if the Cancel button should be enabled, and false if it should be disabled
Returns:
the saved UI state

createWizardClosingDialog

protected 
MessageDialog createWizardClosingDialog()
Creates and returns a new wizard closing dialog without opening it.


close

public boolean close()
Overrides:
close in class Dialog

okToClose

protected boolean okToClose()
Checks whether it is alright to close this wizard dialog and perform standard cancel processing. If there is a long running operation in progress, this method posts an alert message saying that the wizard cannot be closed.

Returns:
true if it is alright to close this dialog, and false if it is not

hardClose

protected boolean hardClose()
Closes this window. Really closes it. Calls super.close()

Returns:
true if the window is (or was already) closed, and false if it is still open

restoreEnableState

protected void restoreEnableState(
Control w,
                                  
Map h,
                                  
String key)
Restores the enabled/disabled state of the given control.

Parameters:
w - the control
h - the map (key type: String, element type: Boolean)
key - the key
See Also:
saveEnableStateAndSet(org.eclipse.swt.widgets.Control, java.util.Map, java.lang.String, boolean)

restoreUIState

protected void restoreUIState(
Map state)
Restores the enabled/disabled state of the wizard dialog's buttons and the tree of controls for the currently showing page.

Parameters:
state - a map containing the saved state as returned by saveUIState
See Also:
saveUIState(boolean)

saveUIState

protected 
Map saveUIState(boolean keepCancelEnabled)
Captures and returns the enabled/disabled state of the wizard dialog's buttons and the tree of controls for the currently showing page. All these controls are disabled in the process, with the possible excepton of the Cancel button.

Parameters:
keepCancelEnabled - true if the Cancel button should remain enabled, and false if it should be disabled
Returns:
a map containing the saved state suitable for restoring later with restoreUIState
See Also:
restoreUIState(java.util.Map)

saveEnableStateAndSet

protected void saveEnableStateAndSet(
Control w,
                                     
Map h,
                                     
String key,
                                     boolean enabled)
Saves the enabled/disabled state of the given control in the given map, which must be modifiable.

Parameters:
w - the control, or null if none
h - the map (key type: String, element type: Boolean)
key - the key
enabled - true to enable the control, and false to disable it
See Also:
restoreEnableState(Control,Map,String)

setDisplayCursor

protected void setDisplayCursor(
Cursor c)
Sets the given cursor for all shells currently active for this window's display.

Parameters:
c - the cursor

setDisplayCursor

public static void setDisplayCursor(
Shell shell,
                                    
Cursor c)
Sets the given cursor for all shells currently active for the given shell's display.

Parameters:
c - the cursor

run

public void run(boolean fork,
                boolean cancelable,
                
IRunnableWithProgress runnable)
         throws 
InvocationTargetException,
                
InterruptedException
For IRunnableContext.

Specified by:
run in interface IRunnableContext
Throws:
InvocationTargetException
InterruptedException

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire