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

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

Introduction

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

Prototype

String VALUE

To view the source code for org.eclipse.jface.preference FieldEditor VALUE.

Click Source Link

Document

Property name constant (value "field_editor_value") to signal a change in the value of this field editor.

Usage

From source file:net.tourbook.preferences.PrefPageAppearanceMap.java

License:Open Source License

@Override
public void propertyChange(final PropertyChangeEvent event) {

    if (event.getProperty().equals(FieldEditor.VALUE)) {

        _isModified = true;//from  w  w  w.  j av a2  s  .  c o m

        if (event.getSource() == _editorTourPaintMethod) {

            // display info for the selected paint method
            final String newValue = (String) event.getNewValue();
            final String oldValue = (String) event.getOldValue();

            if (oldValue.equals(TOUR_PAINT_METHOD_SIMPLE) && newValue.equals(TOUR_PAINT_METHOD_COMPLEX)
                    && net.tourbook.util.UI.IS_OSX) {

                MessageDialog.openWarning(getShell(), Messages.Pref_MapLayout_Dialog_OSX_Warning_Title,
                        Messages.Pref_MapLayout_Dialog_OSX_Warning_Message);
            }

            setUIPaintMethodInfo(newValue);
        }

        enableControls(_editorTourWithBorder.getBooleanValue());
    }

    super.propertyChange(event);
}

From source file:net.tourbook.preferences.PrefPageMap2Appearance.java

License:Open Source License

@Override
public void propertyChange(final PropertyChangeEvent event) {

    final String eventProperty = event.getProperty();

    if (eventProperty.equals(FieldEditor.VALUE)) {

        _isModified = true;//  w w  w  .ja  v  a  2 s  .  co  m

        if (event.getSource() == _editorTourPaintMethod) {

            // display info for the selected paint method
            final String newValue = (String) event.getNewValue();
            final String oldValue = (String) event.getOldValue();

            if (oldValue.equals(TOUR_PAINT_METHOD_SIMPLE) && newValue.equals(TOUR_PAINT_METHOD_COMPLEX)
                    && net.tourbook.common.UI.IS_OSX) {

                MessageDialog.openWarning(getShell(), Messages.Pref_MapLayout_Dialog_OSX_Warning_Title,
                        Messages.Pref_MapLayout_Dialog_OSX_Warning_Message);
            }

            setUIPaintMethodInfo(newValue);
        }

        enableControls();
    }

    super.propertyChange(event);

    if (_chkLiveUpdate.getSelection()) {
        performApply();
    }
}

From source file:net.tourbook.preferences.PrefPageStatisticTourFrequency.java

License:Open Source License

@Override
public void propertyChange(final PropertyChangeEvent event) {
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        if (!_editorAltitudeLowValue.isValid() || !_editorDistanceLowValue.isValid()
                || !_editorDistanceInterval.isValid() || !_editorDistanceNumbers.isValid()
                || !_editorAltitudeLowValue.isValid() || !_editorAltitudeInterval.isValid()
                || !_editorAltitudeNumbers.isValid() || !_editorDurationLowValue.isValid()
                || !_editorDurationInterval.isValid() || !_editorDurationNumbers.isValid()) {
            return;
        }/*from www .j a va2 s  . c  o  m*/

        computeAllExamples();
    }
}

From source file:org.codehaus.groovy.eclipse.preferences.ScriptFolderSelectorPreferences.java

License:Apache License

public ListDialogField createListContents() {
    Label label = new Label(parent, SWT.WRAP);
    label.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
    label.setText("Groovy Script Folders:");
    label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));

    Composite inner = new Composite(parent, SWT.BORDER);
    inner.setFont(parent.getFont());/*from  w  w w.  ja v  a 2  s  .  c om*/
    GridLayout layout = new GridLayout();
    layout.marginHeight = 3;
    layout.marginWidth = 3;
    layout.numColumns = 1;
    inner.setLayout(layout);
    inner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    disableButton = new BooleanFieldEditor(Activator.GROOVY_SCRIPT_FILTERS_ENABLED,
            "Enable script folder support", BooleanFieldEditor.DEFAULT, inner);

    disableButton.setPreferenceStore(store);
    disableButton.load();

    // inner composite contains the dialog itself
    final Composite innerInner = new Composite(inner, SWT.NONE);
    innerInner.setFont(parent.getFont());
    layout = new GridLayout();
    layout.marginHeight = 3;
    layout.marginWidth = 3;
    layout.numColumns = 3;
    innerInner.setLayout(layout);
    innerInner.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    innerInner.setToolTipText("CHECKED boxes are COPIED to output folder.\nUNCHECKED boxes are NOT copied.");
    boolean enabled = disableButton.getBooleanValue();
    innerInner.setEnabled(enabled);

    // enable/disable pattern list based
    disableButton.setPropertyChangeListener(new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty() == FieldEditor.VALUE) {
                Object o = event.getNewValue();
                if (o instanceof Boolean) {
                    boolean enabled = ((Boolean) o);
                    innerInner.setEnabled(enabled);
                    for (Control c : innerInner.getChildren()) {
                        c.setEnabled(enabled);
                    }
                }
            }
        }
    });

    ScriptPatternAdapter adapter = new ScriptPatternAdapter();

    patternList = new CheckedListDialogField(adapter, buttonLabels, new ScriptLabelProvider(DESCRIPTOR));
    patternList.setDialogFieldListener(adapter);
    patternList.setLabelText("Groovy files that match these patterns are treated as scripts.  "
            + "They will not be compiled and will be copied as-is to the output folder.\n\n"
            + "CHECKED boxes will be COPIED to the output folder.  UNCHECKED boxes are NOT copied to the output folder.");
    patternList.setRemoveButtonIndex(IDX_REMOVE);
    patternList.enableButton(IDX_EDIT, false);
    patternList.setCheckAllButtonIndex(IDX_CHECKALL);
    patternList.setUncheckAllButtonIndex(IDX_UNCHECKALL);

    patternList.doFillIntoGrid(innerInner, 3);
    Label l = patternList.getLabelControl(innerInner);
    GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false);
    gd.widthHint = 200;
    l.setLayoutData(gd);

    resetElements();
    patternList.enableButton(IDX_ADD, true);
    patternList.setViewerComparator(new ViewerComparator());

    // finally force greying out of tree if required
    innerInner.setEnabled(enabled);
    for (Control c : innerInner.getChildren()) {
        c.setEnabled(enabled);
    }

    return patternList;
}

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  ww  .  ja va2 s . c  o m
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.buckminster.ui.prefs.DynamicPreferencePage.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        if (event.getSource() instanceof ResolutionResolverListEditor)
            selectResolverPropertyPane(event.getNewValue());
    } else//from  w w  w .j  av a 2 s. c o m
        super.propertyChange(event);
}

From source file:org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints.GDBDynamicPrintfPropertyPage.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);

    ICBreakpoint currentBp = getDprintf();
    if (!(currentBp instanceof ICFunctionBreakpoint) && !(currentBp instanceof ICAddressBreakpoint)) {
        // Check for duplication of line dprintf
        if (event.getProperty().equals(FieldEditor.VALUE)) {
            if (super.isValid()) {
                // For every change, if all the fields are valid
                // we then check if we are dealing with a duplicate
                // breakpoint.
                boolean oldValue = fDuplicateBreakpoint;
                fDuplicateBreakpoint = isDuplicateBreakpoint();
                if (oldValue != fDuplicateBreakpoint) {
                    if (fDuplicateBreakpoint) {
                        setErrorMessage(BreakpointsMessages
                                .getString("CBreakpointPropertyPage.breakpoint_already_exists_errorMessage")); //$NON-NLS-1$
                    } else {
                        setErrorMessage(null);
                    }/*from w  ww .j  ava 2s . c om*/
                    // update container state
                    if (getContainer() != null) {
                        getContainer().updateButtons();
                    }
                    // update page state
                    updateApplyButton();
                }
            }
        }
    }
}

From source file:org.eclipse.cdt.internal.autotools.ui.properties.AbstractConfigurePropertyOptionsPage.java

License:Open Source License

/**
 * Method called when the value of a dialog field changes
 *//*from ww  w .  j av a2  s.com*/
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        setDirty(true);
    }
}

From source file:org.eclipse.cdt.managedbuilder.ui.properties.AbstractToolSettingUI.java

License:Open Source License

/**
 * Method called when the value of a dialog field changes
 *//*  w  w w  .jav a2s .c o m*/
@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        setDirty(true);
    }
}

From source file:org.eclipse.debug.internal.ui.views.memory.renderings.TableRenderingPreferencePage.java

License:Open Source License

public void propertyChange(PropertyChangeEvent event) {
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        if (event.getSource().equals(fPageSize) || event.getSource().equals(fPostBufferSize)
                || event.getSource().equals(fPreBufferSize)) {
            validatePageSize();/* w  w w  .  ja  va  2  s.  c  o  m*/
        }
    }

}