B A
B A

Reputation: 71

adding wizardPages dynamically and returning the result

I created a Wizard, then I created a WizardPage namely FrontPage and added it to wizard in wizard's addPage method.

Since I have only one page in addPage method, the Next button not shown. I want it to be shown.

In the nextPressed method of the FrontPage, I created an instance of another java class that the class runs the program written in another language. In several points of that program, I need to create wizardPage dynamically. For this purpose I created a java class to contribute to the program. This class namely interfaceRule create an instances of wizardPage in other plugin.

My questions is how can I add this wizardPages to the main wizard? And also how can I return the value that user select in wizardPage to interfaceRule class?

edit:

public IWizardPage getNextPage() {
    boolean isNextPressed = "nextPressed".equalsIgnoreCase(Thread.currentThread().getStackTrace()[2].getMethodName());
    if (isNextPressed) {
        boolean validatedNextPress = this.nextPressed();
        if (!validatedNextPress) {
            return this;
        }
    }
    return super.getNextPage();
}

Upvotes: 0

Views: 65

Answers (1)

greg-449
greg-449

Reputation: 111142

There are several ways to control the Next button in your class extending Wizard

You can call setForcePreviousAndNextButtons(true) in the wizard constructor to force the buttons always to be shown.

You can override the needsPreviousAndNextButtons method to decide if the buttons are required dynamically.

You can override the getNextPage method:

public IWizardPage getNextPage(final IWizardPage page)

to control exactly which page is shown next (also getPreviousPage).

Upvotes: 1

Related Questions