Title: Default
1eclipse - A Smart Development Platform
- JFace Dialogs and Wizards
- an interactive mechanism to gather user's input
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
2eclipse - A Smart Development Platform
- Agenda for the Session
- What are Dialogs ?
- Standards Dialogs available in Eclipse
- What are Wizards ?
- How to implement a wizard ?
- Initialize its contents, and perform actions on
its completion.
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
3eclipse - A Smart Development Platform
- What are Dialogs ?
- Eclipse provides Standard dialogs for
- displaying user messages
- obtaining simple input from the user.
- Where can I find them ?
- The package org.eclipse.jface.dialogs defines the
support for dialogs.
- Types of Standard Dialogs
- MessageDialogs displays a message to the user.
- ErrorDialogs displays information about an error.
- InputDialogs allows the user to enter text.
- ProgressMonitorDialog shows progress during a
long operation.
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
4eclipse - A Smart Development Platform
What are Wizards ? Wizards are a powerful
interesting components from the JFace toolkit.
A wizard, coupled with other user interface
components within the SWT, provides a flexible
mechanism to systematically gather user input and
perform data validation.
- Why or When are Wizards required ?
- meant to take the hassle out of standard,
repetitive, or tedious user tasks. - can considerably simplify user tasks and increase
productivity.
- How to write your own Wizards ?
- You will need to use the org.eclipse.jface.wizard
package of JFace . - Your plug-in can contribute wizards at predefined
extension points. - You can also create and launch your own wizards.
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
5eclipse - A Smart Development Platform
A wizard is composed of several different
underlying parts.
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
6eclipse - A Smart Development Platform
Lets build our own Wizard now
Step 1. Create a class that extends
org.eclipse.jface.wizard.Wizard Step 2. Create a
class that extends org.eclipse.jface.wizard.IWizar
dPage Step 3. Override addPages() to add the
Pages to the Wizard. Step 4. To complete a Wizard
override performFinish() or performCancel()
Creating the Controls on the Page
createControl() is the place in the Page to
create the Controls and arrange.
public void createControl(Composite parent)
Step 1. Create a composite using the specified
parent Step 2. Construct the widgets and, if
necessary, their layout data objects Step 3. Set
the composite as the control associated with the
wizard page
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
7eclipse - A Smart Development Platform
Performing Data Validation
Step 1. Handling Events Step 2. Processing Errors
- Handling Events on your Page
- The page needs to implement org.eclipse.swt.widget
s.Listener. - add listeners in the createControl method to the
required widgets. - Button button new Button(composite,
SWT.PUSH) button.addListener(SWT.Selection,
this) - Implement the handleEvent(Event e)?
- public void handleEvent(Event e)
- if (e.widget button)
- MessageDialog.openInformation(this.getShell(
), , Press) -
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
8eclipse - A Smart Development Platform
Performing Data Validation
Step 1. Handling Events Step 2. Processing Errors
- Processing Errors
- To display information or error messages use
methods - setMessage()
- setErrorMessage()?
- Pls.Note When the page is correct, we should
see the page has no error msg set.
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
9eclipse - A Smart Development Platform
Managing Navigation Buttons
- Navigation Buttons available in a Wizard are
Back, Next, Finish Cancel. - By default,
- Next is enabled for all but the last page
- Back for all pages but the first.
- To enable/disable the Next and Finish buttons
- canFlipToNextPage Activates Next Button
- canFinish Activates Finish Button
- Whenever there is an Event fired we can call
inside the handleEvent() - getWizard().getContainer().updateButtons()
-
- This would ensure the activation of Next and
Finish based. - Pls.Note
- ensure that the methods from above are called at
the right moment to enable/disable the Next and
Finish buttons
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
10eclipse - A Smart Development Platform
Changing the Page Order
We can change the order of the wizard pages by
overwriting the getNextPage method of any wizard
page.
When will you want to Change the Page Order
? Based on some selection criteria in the current
page you would want to change the page that
appears on next.
- Contribute to the extension points of Eclipse
- new wizard
- Import wizard
- export wizard
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.
11eclipse - A Smart Development Platform
Defining a wizard contribution
In our sample, we contribute to the new wizard
extension point ltextension id"com.xyz.article.w
izards nameEclipse Examples"
point"org.eclipse.ui.newWizards"gt ltcategory
nameExample Wizards id"com.xyz.articl
e.wizards.category1"gt lt/categorygt ltwizard
nameEclipse Wizard 1" icon"icons/create.gif
" category"com.xyz.article.wizards.category1"
class"com.xyz.article.wizards.HolidayDocumentWiz
ard" id"com.xyz.article.wizards.wizard1"gt
ltdescriptiongt Create a Sample Wizard
lt/descriptiongt lt/wizardgt lt/extensiongt
ANCiT Technologis reserves all rights even in the
event of industrial property rights. We reserve
all rights of disposal such as copying and
passing on to third parties.