Example usage for org.eclipse.jface.preference FieldEditor setPage

List of usage examples for org.eclipse.jface.preference FieldEditor setPage

Introduction

In this page you can find the example usage for org.eclipse.jface.preference FieldEditor setPage.

Prototype

public void setPage(DialogPage dialogPage) 

Source Link

Document

Set the page to be the receiver.

Usage

From source file:de.hasait.eclipse.ccg.properties.CcgProjectPropertyPage.java

License:Apache License

protected final void addFieldEditor(final FieldEditor fieldEditor) {
    _fieldEditors.add(fieldEditor);//from  ww w.  ja va  2 s . c o m
    fieldEditor.setPage(this);
    fieldEditor.setPreferenceStore(getPreferenceStore());
    fieldEditor.load();
}

From source file:gov.redhawk.internal.ui.preferences.PlotPreferencePage.java

License:Open Source License

@Override
protected void initialize() {
    super.initialize();
    if (blockPreferenceStore != null) {
        Iterator<FieldEditor> e = blockPreferences.iterator();
        while (e.hasNext()) {
            FieldEditor pe = e.next();
            pe.setPage(this);
            pe.setPropertyChangeListener(this);
            pe.setPreferenceStore(blockPreferenceStore);
            pe.load();/* w  w  w  .  ja  v  a  2 s . c o  m*/
        }
    }
}

From source file:net.sf.savedirtyeditors.preferences.PluginPreferencePage.java

License:Open Source License

private FieldEditor createStringFieldEditor(final Composite spacingComposite, final String preferenceKey,
        final String labelText) {
    final FieldEditor editor = new StringFieldEditor(preferenceKey, labelText, spacingComposite);
    editor.setPreferenceStore(PluginActivator.getDefault().getPreferenceStore());
    editor.setPage(this);
    editor.load();// ww  w  . jav  a 2 s. com
    return editor;
}

From source file:org.bonitasoft.studio.preferences.pages.BonitaAppearancePreferencePage.java

License:Open Source License

@Override
protected void initialize() {

    if (fieldEditors != null) {
        Iterator<FieldEditor> e = fieldEditors.iterator();
        while (e.hasNext()) {
            FieldEditor pe = e.next();
            pe.setPage(this);
            pe.setPropertyChangeListener(this);
            if (pe.getPreferenceStore() == null) {
                pe.setPreferenceStore(getPreferenceStore());
            }// w w  w .  ja  v a 2  s. c o m
            pe.load();
        }
    }

}

From source file:org.csstudio.diirt.util.preferences.BasePreferencePage.java

License:Open Source License

/**
 * Add the given {@code editor} field to this page. The editor's
 * caption foreground will be updated when the editor's value changes.
 *
 * @param fieldEditor The {@link FieldEditor} to be added and updated.
 * @param parent The {@link Composite} owning the given {@code editor}.
 * @param canBeDefaulted {@code true} if the given {@code editor} can be
 *            restored to its default value.
 * @param defaultGetter The {@link Supplier} of the editor's default value.
 *            Can be {@code null} if the editor's caption foreground
 *            should not be updated when the editor's value changes.
 * @param storedGetter The {@link Supplier} of the editor's stored value.
 *            Can be {@code null} if the editor's caption foreground
 *            should not be initially updated.
 * @param listener Called when a field editor fires a value property change.
 *//* w w  w.j ava  2s .c om*/
protected void addField(FieldEditor fieldEditor, Composite parent, boolean canBeDefaulted,
        Supplier<Object> defaultGetter, Supplier<Object> storedGetter, IPropertyChangeListener listener) {

    final IPreferenceStore store = getPreferenceStore();
    final Editor editor = new Editor(fieldEditor, parent, canBeDefaulted, defaultGetter, storedGetter);

    fieldEditor.getLabelControl(parent).setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
    fieldEditor.setPage(this);
    fieldEditor.setPreferenceStore(store);
    fieldEditor.load();
    fieldEditor.setPropertyChangeListener(e -> {
        if (FieldEditor.VALUE.equals(e.getProperty())) {

            if (storedGetter != null) {
                editor.setRestartRequired(!Objects.equals(e.getNewValue(), storedGetter.get()));
            }

            editor.updateCaptionColor(e.getNewValue());

            if (listener != null) {
                listener.propertyChange(e);
            }

        }
    });

    editor.updateCaptionColor();
    editors.put(fieldEditor, editor);

    if (PREF_CONFIGURATION_DIRECTORY.equals(fieldEditor.getPreferenceName())) {
        directoryEditor = editor;
    }

}

From source file:org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointPropertyPage.java

License:Open Source License

void cleanEditorsFromComposite() {
    if (fEventArgsFEs != null) {
        for (FieldEditor editor : fEventArgsFEs) {
            editor.setPreferenceStore(null);
            editor.setPage(null);
        }/*from ww  w. ja va 2  s .  c  o m*/
    }
}

From source file:org.eclipse.cdt.debug.internal.ui.breakpoints.CBreakpointPropertyPage.java

License:Open Source License

private void displayEventArgs(ICBreakpoint breakpoint, Composite parent) {
    boolean result = false;
    String[] debugModelIds = getDebugModelIds();

    try {/*from   w ww .j a v a 2  s .co m*/
        ICBreakpointsUIContribution[] cons;
        CBreakpointUIContributionFactory factory = CBreakpointUIContributionFactory.getInstance();
        IPreferenceStore prefStore = getPreferenceStore();
        if (prefStore instanceof CBreakpointPreferenceStore) {
            cons = factory.getBreakpointUIContributions(debugModelIds, breakpoint,
                    ((CBreakpointPreferenceStore) prefStore).getAttributes());
        } else {
            cons = factory.getBreakpointUIContributions(breakpoint);
        }
        for (ICBreakpointsUIContribution con : cons) {
            if (con.getMarkerType().equalsIgnoreCase(ICEventBreakpoint.C_EVENT_BREAKPOINT_MARKER)
                    && !con.getId().equals(ICEventBreakpoint.EVENT_TYPE_ID)) {
                setupArgsComposite(parent);
                FieldEditor fieldEditor = con.getFieldEditor(con.getId(), con.getLabel() + ":", //$NON-NLS-1$
                        fEventArgsComposite);
                if (fieldEditor != null) {
                    fieldEditor.setPreferenceStore(getPreferenceStore());
                    fieldEditor.setPage(this);
                    addEditorToComposite(fieldEditor);
                    addField(fieldEditor);
                    result = true;
                }
            }
        }
    } catch (CoreException ce) {
        CDebugUIPlugin.log(ce);
    }

    if (fEventArgsComposite != null && !fEventArgsComposite.isDisposed()) {
        fEventArgsComposite.setVisible(result);
        fEventArgsComposite.layout();
        fEventBPComposite.layout();
    }
}

From source file:org.eclipse.wb.core.controls.jface.preference.FieldLayoutPreferencePage.java

License:Open Source License

/**
 * 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>.
 *//*ww  w  .  j a  v  a  2s .  c om*/
@Override
public void dispose() {
    super.dispose();
    for (FieldEditor fieldEditor : fields) {
        fieldEditor.setPage(null);
        fieldEditor.setPropertyChangeListener(null);
        fieldEditor.setPreferenceStore(null);
    }
}

From source file:org.eclipse.wb.core.controls.jface.preference.FieldLayoutPreferencePage.java

License:Open Source License

/**
 * Initializes all field editors./*w w w.jav a2  s.co  m*/
 */
protected void initialize() {
    for (FieldEditor fieldEditor : fields) {
        fieldEditor.setPage(null);
        fieldEditor.setPropertyChangeListener(this);
        fieldEditor.setPreferenceStore(getPreferenceStore());
        fieldEditor.load();
    }
}

From source file:org.eclipse.wb.swt.FieldLayoutPreferencePage.java

License:Open Source License

/**   
 * 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>.
 *///from ww  w  .  j  ava2s  . co  m
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);
        }
    }
}