views:

104

answers:

1

When creating a preference page in RCP, e.g. something like:

public class MyPreferencePage extends org.eclipse.jface.preference.PreferencePage  implements IWorkbenchPreferencePage

how can I remove the "Restore default values" and "Apply" buttons which get added by default. Using

this.getDefaultsButton().setVisible(false);
this.getApplyButton().setVisible(false);

results in an error.

+2  A: 

Call PreferencePage.noDefaultAndApplyButton() before your control is created.

Francis Upton
Wow, how could I miss that? By the way, noDefaultAndApplyButton() is not a static method, so it needs to be called on the object not on the class.
Joscha
Yes, I know it's not static, it's just the way I write the method, it was not a suggested line of code :)
Francis Upton