I'm writing a wizard for an Eclipse RCP application. After doing some processing on a file and taking some user input, I don't want to let the user go back to make changes. At this point they must either accept or reject the changes they are about to make to the system.
What I can't seem to find is a method call that lets me override the buttons that display or the user's ability to hit the back button. I'd prefer that it not be there or at least be disabled.
Has anyone found a way to do this using the JFace Wizard and WizardPage?
Usability-wise, am I breaking wizard conventions? Should I consider a different approach to the problem?
You can return null from the getPreviousPage() method in your wizard page implementation.
Expanding on jodonell's answer:
Disabling the back button is harder than it should be, due to non-intuitive behavior in the default implementation of WizardPage.getPreviousPage(). You can call setPreviousPage( null ), and getPreviousPage() still returns the previous page. You need to override the implementation of getPreviousPage() in order to disable the back button:
public abstract class MyWizardPage extends WizardPage {
private boolean backButtonEnabled = true;
public void setBackButtonEnabled(boolean enabled) {
backButtonEnabled = enabled;
getContainer().updateButtons();
}
@Override
public IWizardPage getPreviousPage() {
if (!backButtonEnabled) {
return null;
}
return super.getPreviousPage();
}
}
See my blog post for a few more JFace wizard tips and tricks:
http://nsawadsky.blogspot.com/2011/07/jface-wizard-tips-and-tricks.html
From a UI perspective this seems rather bad. Your users are going to get frustrated if they make a mistake and want to go back and correct it and you don't let them. I think it would be much better to change the application to allow going back rather than looking for ways to prevent it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With