You need to send a message to the user and/or get a little feedback from the user .
9.1.2 Solution
Use the SWT MessageBox class to create a message box, and check the return value from its open method to determine which button the user clicked.
9.1.3 Discussion
Here are the MessageBox class's methods :
String getMessage( )
Returns the dialog's message
int open( )
Makes the dialog visible
void setMessage(String string)
Sets the dialog's message
You create a message box by passing the current shell to the MessageBox constructor, as well as the style you want to use: MessageBox(Shell parent, int style) . Here are some common styles to use:
SWT.ICON_ERROR
SWT.ICON_INFORMATION
SWT.ICON_QUESTION
SWT.ICON_WARNING
SWT.ICON_WORKING
SWT.OK
SWT.OK SWT.CANCEL
SWT.YES SWT.NO
SWT.YES SWT.NO SWT.CANCEL
SWT.RETRY SWT.CANCEL
SWT.ABORT SWT.RETRY SWT.IGNORE .
You use the message box's open method to display it; when the message box is closed, compare this method's int return value to one of the preceding styles such as SWT.YES , SWT.NO , or SWT.CANCEL to determine which button was clicked.