Pregunta

I created a JFace wizard showing a single list where the user is supposed to make a selection. Since the page just contains a list, I would like to enable the double click selection. If the user performs a double click on a single event, the wizard should jump to the next page.

I got the following code so far:

 viewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            if (selection.getFirstElement() instanceof File) {
                if(canFlipToNextPage()) {
                   //perform jump to next page here.
                }
            }
        }
    });

Apparently there is no method for the programmatic execution of the next button. Thank you.

¿Fue útil?

Solución

You first need a reference to the wizard page where you want to go. If you don't have it already through other means, you can find all wizard pages via this API:

getWizard().getPages()

Next, you make the following call:

getContainer().showPage( desiredPage )

Otros consejos

You can also access the next page, so a more generic solution would be:

if (canFlipToNextPage()) {
    IWizardPage page = getNextPage();
    if (page != null) {
        getContainer().showPage(page);
    }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top