Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » add listener to next button wizard page
add listener to next button wizard page [message #1630708] Mon, 23 February 2015 10:49 Go to next message
bilel troudi is currently offline bilel troudiFriend
Messages: 1
Registered: February 2015
Junior Member

Can anyone please tell me how exactly one can associate listener to 'Next' button of JFACe wizard page?? OR Is there any API which can be overwritten to perform action when 'Next' button is clicked in wizard page??

My requirement is to perform some action when the user clicks 'Next' button of the wizard page.

Thanks in advance,
Re: add listener to next button wizard page [message #1647624 is a reply to message #1630708] Tue, 03 March 2015 14:27 Go to previous messageGo to next message
Sascha Hanke is currently offline Sascha HankeFriend
Messages: 21
Registered: April 2014
Location: Germany
Junior Member
Hi there,

I perfom actions on my wizardpages on back/next/finish like this.
I've overwritten WizardDialog and WizardPage so my WizardDialog simply calls a method "nextPressed" on my WizardPage.

CustomWizardDialog extends WizardDialog:
	protected void nextPressed() {
		IWizardPage currentActivePage = getCurrentPage();
		/* notify current page if it wants to do any validation on input */
		if( !((DefaultWizardPage)currentActivePage).nextPressed() ) return;
		/* delegate nextPressed processing to super */

CustomWizardPage extends WizardPage:
protected boolean nextPressed() { 
		try {;
			return true;
		} catch (Exception e) {
			eclipseContext.get(IEventBroker.class).send("EXCEPTION_SHOW_TO_USER", e);
		return false;
Re: add listener to next button wizard page [message #1719720 is a reply to message #1647624] Mon, 11 January 2016 16:36 Go to previous message
Duc Quoc is currently offline Duc QuocFriend
Messages: 4
Registered: January 2016
Junior Member
Based on previous answer, I tried the following code in my custom WizardPage to override the getNextPage() so that it can utilize nextPressed() without the necessity to override WizardDialog:

    /** @override */
    public org.eclipse.jface.wizard.IWizardPage getNextPage() {
        //kind of hack to detect without overriding WizardDialog#nextPressed()
        boolean isNextPressed = "nextPressed".equalsIgnoreCase(Thread.currentThread().getStackTrace()[2].getMethodName());
        if (isNextPressed) {
            boolean validatedNextPress = this.nextPressed();
            if (!validatedNextPress) {
                return this;
        return super.getNextPage();

     * @see WizardDialog#nextPressed()
     * @see WizardPage#getNextPage()
    protected boolean nextPressed() {
        boolean validatedNextPressed = true;
        try {
            //your checking here: remote connection, local directory/file creation, showing dialogs, etc... 
        } catch (Exception ex) {
            System.out.println("Error validation when pressing Next: " + ex);
        return validatedNextPressed;

Hope this helps,
Previous Topic:Eclipse warns about deprecated methods
Next Topic:Data binding to an EMF model via feature path
Goto Forum:

Current Time: Tue Apr 20 21:03:39 GMT 2021

Powered by FUDForum. Page generated in 0.02208 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top