rcp5
TRANSCRIPT
-
8/12/2019 RCP5
1/14
1
Sanjay Shah
Santosh Shah
-
8/12/2019 RCP5
2/14
SWT Dialogs
Why Wizards?
Adding Wizards to Application
Creating WizardPages
Adding pages and calling the wizard
Adding Popup menu contribution
Wrap up
2
-
8/12/2019 RCP5
3/14
Why Dialogs?
3
-
8/12/2019 RCP5
4/14
ColorDialogDialog for selecting a color
DirectoryDialogDialog for selecting adirectory in host file system.
FileDialogDialog for selecting a file in hostfile system. Supported styles are SWT.OPENand SWT.SAVE
FontDialog
Dialog for selecting text font MessageBoxDialog for displaying a message.
PrintDialogDialog for selecting printer andfor printer settings
4
-
8/12/2019 RCP5
5/14
Message boxMessageBox box = new
MessageBox(view.getSite().getShell(),SWT.ICON_INFORMATION);
box.setMessage("Hello! You clicked view action!");box.open()
5
-
8/12/2019 RCP5
6/14
IconAndMessageDialogsuperclass of dialogswith an icon and a message.
StatusDialogsuperclass for dialogs with
status bar TitleAreaDialogdialog having a title area.
ErrorDialogA dialog to display errors
MessageDialogdialog class for showingmessages to the user.
ProgressMonitorDialogA modal dialog todisplay progress of a operation.
6
-
8/12/2019 RCP5
7/14
WizardDialogA dialog to show a wizard tothe end user.
InputDialogA simple input dialog for getting
an input from the user.
7
-
8/12/2019 RCP5
8/14
InputDialog dialog = new InputDialog(view.getSite().getShell(),"Letstry!", "Please enter your name","",null); // new input dialog
if( dialog.open()== IStatus.OK){ // open dialog and wait for returnstatus code. // If user clicks ok display message box
String value = dialog.getValue(); // fetch the value entered by theuser. MessageBox box = newMessageBox(view.getSite().getShell(),SWT.ICON_INFORMATION);
box.setMessage("Hey there! You entered : " + value); box.open(); }else{
MessageBox box = newMessageBox(view.getSite().getShell(),SWT.ICON_INFORMATION); box.setMessage("Bye!"); box.open(); }
8
-
8/12/2019 RCP5
9/14
Why Wizards?
9
-
8/12/2019 RCP5
10/14
Most common pattern across Eclipse
Examples :New Project ,Import Project etc.
Interfaces:org.eclipse.jface.wizard.IWizard and
org.eclipse.jface.wizard.IWizardPage
10
-
8/12/2019 RCP5
11/14
public class PersonalInformationPage extendsWizardPage {
public void createControl(Composite parent) {
}
}
11
-
8/12/2019 RCP5
12/14
public class CaptureEmployeeInfomrationWizardextends Wizard {
public boolean performFinish() { return false;
}
12
-
8/12/2019 RCP5
13/14
//Override the addpages() method in main
Wizard Class.
public void addPages() {
}
13
-
8/12/2019 RCP5
14/14
//Adding Help information
helpAction =ActionFactory.HELP_CONTENTS.create(wind
ow); register(helpAction);
14