Reputation: 65
How to change the default title
of preferences page from "Preferences" to "Settings" in Eclipse RCP?
Upvotes: 2
Views: 1434
Reputation: 13974
If you are using the org.eclipse.ui.preferencePages
then I think it is not possible. 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
configureShell
methodPreferenceDialog
from the above created actionExtended 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:
Upvotes: 5