[英]How to change title of preference page in eclipse RCP application?
如何在Eclipse RCP中将首选项页面的默认title
从“首选项”更改为“设置”?
If you are using the org.eclipse.ui.preferencePages
then I think it is not possible. 如果您使用的是
org.eclipse.ui.preferencePages
那么我认为这是不可能的。 The help of the same says: 相同的帮助说:
The workbench provides one common dialog box for preferences.
工作台为首选项提供了一个通用对话框。 The purpose of this extension point is to allow plug-ins to add pages to the preference dialog box .
此扩展点的目的是允许插件将页面添加到首选项对话框 。 When preference dialog box is opened (initiated from the menu bar), pages contributed in this way will be added to the dialog box.
当打开首选项对话框(从菜单栏启动)时,以这种方式贡献的页面将被添加到对话框中。
But there is a way round. 但是有办法解决。 Follow the below steps ( This is just showing how you can change the title text ):
请按照以下步骤操作( 这只是显示如何更改标题文本 ):
org.eclipse.jface.preference.PreferenceDialog
org.eclipse.jface.preference.PreferenceDialog
类 configureShell
method configureShell
方法 PreferenceDialog
from the above created action PreferenceDialog
Extended Class
class MyPreferenceDialog extends PreferenceDialog
{
public MyPreferenceDialog(Shell parentShell, PreferenceManager manager) {
super(parentShell, manager);
}
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("Settings");
}
}
Code For Invocation
Button prefButton = new Button(top, SWT.PUSH);
prefButton.setText("Preference");
prefButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
final PreferenceManager preferenceManager = PlatformUI.getWorkbench().getPreferenceManager();
MyPreferenceDialog dialog = new MyPreferenceDialog(top.getShell(), preferenceManager);
dialog.create();
dialog.open();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
The resultant preference dialog looks like this: 结果首选项对话框如下所示:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.