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.
我正在为Eclipse RCP应用程序编写一个向导。在对文件进行一些处理并获取一些用户输入之后,我不想让用户返回进行更改。此时,他们必须接受或拒绝他们将要对系统进行的更改。
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?
有没有人找到使用JFace向导和WizardPage这样做的方法?
Usability-wise, am I breaking wizard conventions? Should I consider a different approach to the problem?
可用性方面,我是否打破了向导惯例?我应该考虑采用不同的方法解决问题吗?
4 个解决方案
#1
11
You can return null from the getPreviousPage() method in your wizard page implementation.
您可以从向导页面实现中的getPreviousPage()方法返回null。
#2
6
Expanding on jodonell's answer:
扩展jodonell的答案:
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:
由于WizardPage.getPreviousPage()的默认实现中的非直观行为,禁用后退按钮比应该更难。您可以调用setPreviousPage(null),getPreviousPage()仍然返回上一页。您需要覆盖getPreviousPage()的实现以禁用后退按钮:
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:
请参阅我的博客文章,了解更多JFace向导提示和技巧:
http://nsawadsky.blogspot.com/2011/07/jface-wizard-tips-and-tricks.html
#3
3
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.
从UI的角度来看,这似乎相当糟糕。如果用户犯了错误并希望返回并纠正它而你不会让他们失望,那么他们会感到沮丧。我认为更改应用程序以允许返回而不是寻找防止它的方法会好得多。
#4
0
There is no way to do this using standard JFace wizard APIs. My team accomplished this by writing a custom WizardDialog. We did this on an Eclipse RCP application and not on an eclipse plugin. Disabling the back button is breaking convention, but our business analysts really wanted the functionality.
使用标准JFace向导API无法执行此操作。我的团队通过编写自定义WizardDialog来完成此任务。我们在Eclipse RCP应用程序上执行此操作,而不是在eclipse插件上执行此操作。禁用后退按钮违反惯例,但我们的业务分析师确实想要这个功能。
#1
11
You can return null from the getPreviousPage() method in your wizard page implementation.
您可以从向导页面实现中的getPreviousPage()方法返回null。
#2
6
Expanding on jodonell's answer:
扩展jodonell的答案:
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:
由于WizardPage.getPreviousPage()的默认实现中的非直观行为,禁用后退按钮比应该更难。您可以调用setPreviousPage(null),getPreviousPage()仍然返回上一页。您需要覆盖getPreviousPage()的实现以禁用后退按钮:
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:
请参阅我的博客文章,了解更多JFace向导提示和技巧:
http://nsawadsky.blogspot.com/2011/07/jface-wizard-tips-and-tricks.html
#3
3
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.
从UI的角度来看,这似乎相当糟糕。如果用户犯了错误并希望返回并纠正它而你不会让他们失望,那么他们会感到沮丧。我认为更改应用程序以允许返回而不是寻找防止它的方法会好得多。
#4
0
There is no way to do this using standard JFace wizard APIs. My team accomplished this by writing a custom WizardDialog. We did this on an Eclipse RCP application and not on an eclipse plugin. Disabling the back button is breaking convention, but our business analysts really wanted the functionality.
使用标准JFace向导API无法执行此操作。我的团队通过编写自定义WizardDialog来完成此任务。我们在Eclipse RCP应用程序上执行此操作,而不是在eclipse插件上执行此操作。禁用后退按钮违反惯例,但我们的业务分析师确实想要这个功能。