It's all about the answers!

Ask a question

Validating input in a WizardPage


John Doran (9182) | asked Apr 05 '10, 7:49 p.m.
Does anyone have a simple example of validating the input for a text field
in a org.eclipse.jface.wizard.WizardPage? (To prevent the user from going to the next page)

The example I am following is

http://www.eclipse.org/articles/article.php?file=Article-JFaceWizards/index.html

Is this typically how it is done in Jazz?

2 answers



permanent link
Patrick Streule (4.9k21) | answered Apr 06 '10, 4:37 a.m.
JAZZ DEVELOPER
Does anyone have a simple example of validating the input for a text
field
in a org.eclipse.jface.wizard.WizardPage? (To prevent the user from
going to the next page)

You may want to take a look at WizardPage#canFlipToNextPage():


/**
* The <code>WizardPage</code> implementation of this
<code>IWizardPage</code>
* method returns <code>true</code> if this page is complete
(<code>isPageComplete</code>)
* and there is a next page to flip to. Subclasses may override
(extend or reimplement).
*
* @see #getNextPage
* @see #isPageComplete()
*/
public boolean canFlipToNextPage() {
return isPageComplete() && getNextPage() != null;
}

--
Regards,
Patrick
Jazz Work Item Team

permanent link
John Doran (9182) | answered Apr 07 '10, 12:49 p.m.
Thank you!

I did 2 things.

In the example, the author has the WizardPage implement Listener.
I use handleEvent() to display Messages to the user
via setMessage() and setErrorMessage(). Also in handleEvent(), I call

getWizard().getContainer().updateButtons()


I am using canFlipToNextPage() to validate the page in my 1st 2 wizard pages. In my last page, canFlipToNextPage() should be false because there is not a next page.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.