Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » FieldEditorPreferencePage/Fieldeditor usage.
FieldEditorPreferencePage/Fieldeditor usage. [message #902307] Thu, 16 August 2012 23:06
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
I'm trying to use FieldEditorPreferencePage and FieldEditors in a Jface/SWT pure environment (no org.eclipse.ui.*).

I've a lot of problems using setPropertyChange() and I tracked down it to the fact FieldEditorPreferencePage.initialize() flatly tromps FieldEditor.propertyChangeListener (in spite of what comments onFieldEditorPreferencePage.propertyChange() say) and I've found no way around (short of copying everything and modifying source).

Also field contents in the pages is very ugly (no justification of field editors).

My code is along the lines:

public class DocEditorPreferencePage extends FieldEditorPreferencePage {

public DocEditorPreferencePage() {
protected void createFieldEditors() {
// Create the field editors
ColorFieldEditor cfeForeground = new ColorFieldEditor(DocEditor.PREFERENCE_COLOR_FOREGROUND, "Foreground color:", getFieldEditorParent());
cfeForeground.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
getPreferenceStore().setValue(DocEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, false);
ColorFieldEditor cfeBackground = new ColorFieldEditor(DocEditor.PREFERENCE_COLOR_BACKGROUND, "Background color:", getFieldEditorParent());
cfeBackground.setPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
getPreferenceStore().setValue(DocEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, false);


public void init() {
// Initialize the preference page
IPreferenceStore store = getPreferenceStore();

// ----------- foreground color --------------------
store.putValue(DocEditor.PREFERENCE_COLOR_FOREGROUND, null);
// ---------- background color ----------------------
store.putValue(DocEditor.PREFERENCE_COLOR_BACKGROUND, null);

What am I missing?

Previous Topic:how does org.eclipse.jface.text.idocument modify content?
Next Topic:WizardPage depend of previous WizardPages
Goto Forum:

Current Time: Tue Jun 19 16:40:49 GMT 2018

Powered by FUDForum. Page generated in 0.01562 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top