How to override next button event of JFace wizard

java, jface, swt, wizard

Solution

You can override `WizardPage.getNextPage()` and return null to prevent the next button from operating.

It is more usual to validate the user input as it happens and call `WizardPage.setPageComplete(false)` to disable the next button completely until the page is valid.

Call `WizardPage.setErrorMessage(msg)` or `WizardPage.setMessage(msg, type)` to display messages.

Problem

I have a wizard comprising of three pages page1 , page2, page3. I'm in page 2 and I press "Next" button , where some validations for duplicate creation needs to verified based on inputs form page1 and a selection inputs entered in page2. Which method should i override inorder to include my validations and pop up a message box(complaining about duplicacy) on click of Next button of page2.

Original source