Java Code Examples for org.eclipse.jface.preference.FieldEditor#setPreferenceStore()

The following examples show how to use org.eclipse.jface.preference.FieldEditor#setPreferenceStore() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProfileView.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
protected void addField(final FieldEditor editor, Composite parent, IPreferenceStore preferenceStore) {
    fields.add(editor);

    editor.setPreferenceStore(preferenceStore);
    editor.load();
    editor.setPropertyChangeListener(new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            // Apply on any change!
            editor.store();
        }
    });
    if (editor instanceof BooleanFieldEditorCustom) {
        editor.fillIntoGrid(parent, 2);
    } else {
        editor.fillIntoGrid(parent, 1);
    }
}
 
Example 2
Source File: AbstractDetailsPart.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public final void propertyChange(PropertyChangeEvent event) {
	if (event.getSource() instanceof FieldEditor) {
		FieldEditor fe = (FieldEditor) event.getSource();
		internalStore.setValue(fe.getPreferenceName(), fe.getPreferenceStore().getDefaultString(fe.getPreferenceName()));
		// store changed value in internalStore
		fe.setPreferenceStore(internalStore);
		fe.store();
		// reset preference store of fieldEditor to chained store, so it also works for other token styles.
		fe.setPreferenceStore(getPreferenceStore());
	}
	super.propertyChange(event);
}
 
Example 3
Source File: GenericFieldEditorPropertyPage.java    From tlaplus with MIT License 5 votes vote down vote up
protected void initialize()
{
    if (fields != null)
    {
        Iterator e = fields.iterator();
        while (e.hasNext())
        {
            FieldEditor fieldEditor = (FieldEditor) e.next();
            fieldEditor.setPage(this);
            fieldEditor.setPreferenceStore(getPreferenceStore());
            fieldEditor.load();
        }
    }
}
 
Example 4
Source File: TypeScriptMainPreferencePage.java    From typescript.java with MIT License 5 votes vote down vote up
/**
 * Initializes and sets up the given editor
 * 
 * @param editor
 * @param store
 */
void initEditor(FieldEditor editor, IPreferenceStore store) {
	addField(editor);
	editor.setPage(this);
	editor.setPropertyChangeListener(this);
	editor.setPreferenceStore(store);
	editor.load();
}
 
Example 5
Source File: FieldLayoutPreferencePage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
/**
 * The field editor preference page implementation of an <code>IDialogPage</code> method disposes of this page's
 * controls and images. Subclasses may override to release their own allocated SWT resources, but must call
 * <code>super.dispose</code>.
 */
@Override
public void dispose() {
    super.dispose();
    if (m_fields != null) {
        Iterator<FieldEditor> I = m_fields.iterator();
        while (I.hasNext()) {
            FieldEditor editor = I.next();
            editor.setPage(null);
            editor.setPropertyChangeListener(null);
            editor.setPreferenceStore(null);
        }
    }
}
 
Example 6
Source File: FieldLayoutPreferencePage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes all field editors.
 */
protected void initialize() {
    if (m_fields != null) {
        Iterator<FieldEditor> I = m_fields.iterator();
        while (I.hasNext()) {
            FieldEditor editor = I.next();
            editor.setPage(null);
            editor.setPropertyChangeListener(this);
            editor.setPreferenceStore(getPreferenceStore());
            editor.load();
        }
    }
}
 
Example 7
Source File: IoPreferencePage.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
private void addField(FieldEditor editor) {
	editors.add(editor);
	editor.setPage(this);
	editor.setPreferenceStore(getPreferenceStore());
	editor.load();
}