Example usage for org.eclipse.jface.preference BooleanFieldEditor getBooleanValue

List of usage examples for org.eclipse.jface.preference BooleanFieldEditor getBooleanValue

Introduction

In this page you can find the example usage for org.eclipse.jface.preference BooleanFieldEditor getBooleanValue.

Prototype

public boolean getBooleanValue() 

Source Link

Document

Returns this field editor's current value.

Usage

From source file:com.blackducksoftware.integration.eclipseplugin.preferences.PreferenceDefaults.java

License:Apache License

private void storeValues() {
    activateByDefault.store();/*from w  ww.j  av  a2 s .  c  om*/
    final IPreferenceStore prefStore = getPreferenceStore();
    for (final BooleanFieldEditor isActive : activeProjectPreferences) {
        prefStore.setValue(isActive.getPreferenceName(), isActive.getBooleanValue());
    }
}

From source file:com.ca.casd.lisa.plugins.odataassistant.preferences.OdataAssistantPreferencePage.java

License:Open Source License

public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    if (event.getProperty().equals(FieldEditor.VALUE)) {
        checkState();//ww w  .  j a  v  a  2  s. c o m
    }

    if (event.getSource() instanceof BooleanFieldEditor) {
        BooleanFieldEditor booleanEditor = (BooleanFieldEditor) event.getSource();
        if (booleanEditor.getPreferenceName().equals(PreferenceConstants.P_ENABLE_POPULATE_TRANSACTIONS))
            fieldMaxNumberEditor.setEnabled(booleanEditor.getBooleanValue(), getFieldEditorParent());
    }

}

From source file:com.ggasoftware.indigo.knime.plugin.IndigoPreferencePage.java

License:Open Source License

@Override
protected void createFieldEditors() {
    final Composite parent = getFieldEditorParent();

    final BooleanFieldEditor enableRenderer = new BooleanFieldEditor(
            IndigoPreferenceInitializer.PREF_ENABLE_RENDERER, "Enable rendering", parent);
    final BooleanFieldEditor coloredRendering = new BooleanFieldEditor(
            IndigoPreferenceInitializer.PREF_COLORING, "Colored rendering", parent);
    final BooleanFieldEditor showImplH = new BooleanFieldEditor(
            IndigoPreferenceInitializer.PREF_SHOW_IMPLICIT_HYDROGENS, "Show implicit hydrogens", parent);
    final IntegerFieldEditor bondLength = new IntegerFieldEditor(IndigoPreferenceInitializer.PREF_BOND_LENGTH,
            "Desired bond length in pixels", parent);
    final IntegerFieldEditor imageWidth = new IntegerFieldEditor(
            IndigoPreferenceInitializer.PREF_MOL_IMAGE_WIDTH, "Molecule image width in pixels", parent);
    final IntegerFieldEditor imageHeight = new IntegerFieldEditor(
            IndigoPreferenceInitializer.PREF_MOL_IMAGE_HEIGHT, "Molecule image height in pixels", parent);

    ((Button) enableRenderer.getDescriptionControl(parent)).addSelectionListener(new SelectionListener() {
        @Override/*ww w  . java 2  s .c  o  m*/
        public void widgetSelected(SelectionEvent e) {
            boolean enabled = enableRenderer.getBooleanValue();

            coloredRendering.setEnabled(enabled, parent);
            showImplH.setEnabled(enabled, parent);
            bondLength.setEnabled(enabled, parent);
            imageWidth.setEnabled(enabled, parent);
            imageHeight.setEnabled(enabled, parent);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    addField(enableRenderer);

    boolean enabled = IndigoPlugin.getDefault().getPreferenceStore()
            .getBoolean(IndigoPreferenceInitializer.PREF_ENABLE_RENDERER);

    addField(coloredRendering);
    addField(showImplH);
    addField(bondLength);
    addField(imageWidth);
    addField(imageHeight);

    coloredRendering.setEnabled(enabled, parent);
    showImplH.setEnabled(enabled, parent);
    bondLength.setEnabled(enabled, parent);
    imageWidth.setEnabled(enabled, parent);
    imageHeight.setEnabled(enabled, parent);
}

From source file:com.litrik.eclipse.xps.preferences.XPSPreferencePage.java

License:Apache License

public void createFieldEditors() {
    addField(new BooleanFieldEditor(XPSPreferenceConstants.P_JUNIT_ENABLED, JUNIT_ENABLED,
            getFieldEditorParent()));/*  ww w . ja va 2s .  co m*/

    // A group for the color preferences
    Group colorGroup = new Group(getFieldEditorParent(), SWT.NONE);
    colorGroup.setText(JUNIT_COLOR);

    // The color when a test run starts
    final LEDColorFieldEditor startLEDColorFieldEditor = new LEDColorFieldEditor(
            XPSPreferenceConstants.P_JUNIT_COLOR_START, JUNIT_COLOR_START, colorGroup);
    addField(startLEDColorFieldEditor);
    // A preview button
    final Button previewStartButton = new Button(colorGroup, SWT.NONE);
    previewStartButton.setText("Preview");

    // The color when a test run was successful
    final LEDColorFieldEditor successLEDColorFieldEditor = new LEDColorFieldEditor(
            XPSPreferenceConstants.P_JUNIT_COLOR_SUCCESS, JUNIT_COLOR_SUCCESS, colorGroup);
    addField(successLEDColorFieldEditor);
    // A preview button
    final Button previewSuccessButton = new Button(colorGroup, SWT.NONE);
    previewSuccessButton.setText("Preview");

    // The color when a test failed
    final LEDColorFieldEditor failureLEDColorFieldEditor = new LEDColorFieldEditor(
            XPSPreferenceConstants.P_JUNIT_COLOR_FAILURE, JUNIT_COLOR_FAILURE, colorGroup);
    addField(failureLEDColorFieldEditor);
    // A preview button
    final Button previewFailureButton = new Button(colorGroup, SWT.NONE);
    previewFailureButton.setText("Preview");

    // The brightness
    final ScaleFieldEditor brightnessScaleFieldEditor = new ScaleFieldEditor(
            XPSPreferenceConstants.P_JUNIT_BRIGHTNESS, JUNIT_BRIGHTNESS, colorGroup, 1, 7, 1, 1);
    addField(brightnessScaleFieldEditor);

    // Pulsate
    addField(new BooleanFieldEditor(XPSPreferenceConstants.P_JUNIT_PULSATE, JUNIT_PULSE, colorGroup));

    // Layout the group
    GridLayout colorGroupLayout = new GridLayout();
    colorGroupLayout.numColumns = 3;
    colorGroup.setLayout(colorGroupLayout);
    GridData colorGroupGridData = new GridData(GridData.FILL_HORIZONTAL);
    colorGroupGridData.horizontalSpan = 2;
    colorGroup.setLayoutData(colorGroupGridData);

    // A group for the time-out preferences
    Group timeOutGroup = new Group(getFieldEditorParent(), SWT.NONE);
    timeOutGroup.setText(JUNIT_TIMEOUT);

    // The time-out after success
    addField(new IntegerFieldEditor(XPSPreferenceConstants.P_JUNIT_TIMEOUT_SUCCESS, JUNIT_TIMEOUT_SUCCESS,
            timeOutGroup, 3));
    final Label secondsSuccessLabel = new Label(timeOutGroup, SWT.NONE);
    secondsSuccessLabel.setText(JUNIT_TIMEOUT_SECONDS);

    // The time-out after failure
    addField(new IntegerFieldEditor(XPSPreferenceConstants.P_JUNIT_TIMEOUT_FAILURE, JUNIT_TIMEOUT_FAILURE,
            timeOutGroup, 3));
    final Label secondsFailureLabel = new Label(timeOutGroup, SWT.NONE);
    secondsFailureLabel.setText(JUNIT_TIMEOUT_SECONDS);

    // Layout the group
    GridLayout timeOutGroupLayout = new GridLayout();
    timeOutGroupLayout.numColumns = 3;
    timeOutGroup.setLayout(timeOutGroupLayout);
    GridData timeOutGroupGridData = new GridData(GridData.FILL_HORIZONTAL);
    timeOutGroupGridData.horizontalSpan = 2;
    timeOutGroup.setLayoutData(timeOutGroupGridData);

    // A group for the LED location preferences
    Group locationGroup = new Group(getFieldEditorParent(), SWT.NONE);
    locationGroup.setText(JUNIT_LOCATION);

    // Fan LEDs
    final BooleanFieldEditor fansBooleanFieldEditor = new BooleanFieldEditor(
            XPSPreferenceConstants.P_JUNIT_LOCATION_FANS, JUNIT_LOCATION_FANS, locationGroup);
    addField(fansBooleanFieldEditor);

    // Speaker LEDs
    final BooleanFieldEditor speakersBooleanFieldEditor = new BooleanFieldEditor(
            XPSPreferenceConstants.P_JUNIT_LOCATION_SPEAKERS, JUNIT_LOCATION_SPEAKERS, locationGroup);
    addField(speakersBooleanFieldEditor);

    // Panel back LEDs
    final BooleanFieldEditor panelBooleanFieldEditor = new BooleanFieldEditor(
            XPSPreferenceConstants.P_JUNIT_LOCATION_PANEL, JUNIT_LOCATION_PANEL, locationGroup);
    addField(panelBooleanFieldEditor);

    // Layout the group
    GridLayout locationGroupLayout = new GridLayout();
    locationGroup.setLayout(locationGroupLayout);
    GridData locationGroupGridData = new GridData(GridData.FILL_HORIZONTAL);
    locationGroupGridData.horizontalSpan = 2;
    locationGroup.setLayoutData(locationGroupGridData);

    // Let the "Preview" buttons do something
    previewStartButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent se) {
            try {
                LEDs.setLeds(startLEDColorFieldEditor.getCurrentValue(),
                        fansBooleanFieldEditor.getBooleanValue(), speakersBooleanFieldEditor.getBooleanValue(),
                        panelBooleanFieldEditor.getBooleanValue(),
                        brightnessScaleFieldEditor.getScaleControl().getSelection());
            } catch (LEDException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Status.OK,
                        "An unexpected error occurred when setting the XPS LEDs.", e));
            }
        }
    });
    previewSuccessButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent se) {
            try {
                LEDs.setLeds(successLEDColorFieldEditor.getCurrentValue(),
                        fansBooleanFieldEditor.getBooleanValue(), speakersBooleanFieldEditor.getBooleanValue(),
                        panelBooleanFieldEditor.getBooleanValue(),
                        brightnessScaleFieldEditor.getScaleControl().getSelection());
            } catch (LEDException e) {
                Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Status.OK,
                        "An unexpected error occurred when setting the XPS LEDs.", e));
            }
        }
    });
    previewFailureButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent se) {
            try {
                LEDs.setLeds(failureLEDColorFieldEditor.getCurrentValue(),
                        fansBooleanFieldEditor.getBooleanValue(), speakersBooleanFieldEditor.getBooleanValue(),
                        panelBooleanFieldEditor.getBooleanValue(),
                        brightnessScaleFieldEditor.getScaleControl().getSelection());
            } catch (LEDException e) {
                Activator.getDefault().getLog().log(
                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, Status.OK, LEDException.MESSAGE, e));
            }
        }
    });

}

From source file:hu.bme.mit.massif.simulink.importer.ui.dialogs.ImportSettingsDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        importedModelName = importedModelNameEditor.getStringValue();
        Set<String> filterIds = filterSelectors.keySet();
        for (String filterId : filterIds) {
            BooleanFieldEditor fieldEditor = filterSelectors.get(filterId);
            filterSelections.put(filterId, fieldEditor.getBooleanValue());
        }/*from   www  .j a v a2s  .c  om*/
    }
    super.buttonPressed(buttonId);
}

From source file:org.carrot2.workbench.core.preferences.WorkbenchPreferencesPage.java

License:Open Source License

@Override
protected void checkState() {
    super.checkState();

    if (isValid()) {
        boolean oneSet = false;
        for (BooleanFieldEditor editor : editors) {
            oneSet |= editor.getBooleanValue();
        }//from   w w w .  j  a  va  2  s.c o  m

        if (!oneSet) {
            setErrorMessage("At least one panel must be visible");
            setValid(false);
        } else {
            setErrorMessage(null);
        }
    }
}

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

License:Open Source License

public void propertyChange(PropertyChangeEvent event) {
    // allow superclass to handle as well
    super.propertyChange(event);

    if (event.getSource() instanceof StringFieldEditor) {
        StringFieldEditor f = (StringFieldEditor) event.getSource();
        cfg.setOption(f.getPreferenceName(), f.getStringValue());
    } else if (event.getSource() instanceof BooleanFieldEditor) {
        BooleanFieldEditor b = (BooleanFieldEditor) event.getSource();
        cfg.setOption(b.getPreferenceName(), Boolean.toString(b.getBooleanValue()));
    }//  w w w.  j  a  v  a2  s. c o  m
}

From source file:org.eclipse.incquery.tooling.ui.queryexplorer.preference.PatternInitializationPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    final IPreferenceStore store = IncQueryGUIPlugin.getDefault().getPreferenceStore();
    Composite control = new Composite(parent, SWT.NONE);
    Label wildcardDescriptionLabel = new Label(control, SWT.NONE | SWT.WRAP);
    wildcardDescriptionLabel.setText(WILDCARD_MODE_DESCRIPTION);
    final GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.horizontalAlignment = SWT.FILL;
    layoutData.widthHint = 200;// ww w.ja  va 2 s .c  o  m
    wildcardDescriptionLabel.setLayoutData(layoutData);
    final BooleanFieldEditor wildcardModeEditor = new BooleanFieldEditor(PreferenceConstants.WILDCARD_MODE,
            "&Wildcard mode", control);
    wildcardModeEditor.setPreferenceStore(IncQueryGUIPlugin.getDefault().getPreferenceStore());
    wildcardModeEditor.load();
    wildcardModeEditor.setPropertyChangeListener(new IPropertyChangeListener() {

        @SuppressWarnings("deprecation")
        @Override
        public void propertyChange(PropertyChangeEvent event) {
            store.setValue(PreferenceConstants.WILDCARD_MODE, wildcardModeEditor.getBooleanValue());
            // the mentioned replace method did not work for me
            IncQueryGUIPlugin.getDefault().savePluginPreferences();
        }
    });
    return control;
}

From source file:org.eclipse.tcf.internal.cdt.ui.preferences.BreakpointPreferencePage.java

License:Open Source License

@Override
public void propertyChange(PropertyChangeEvent event) {
    super.propertyChange(event);
    Object button = event.getSource();
    if (button instanceof BooleanFieldEditor) {
        BooleanFieldEditor fe = (BooleanFieldEditor) button;
        defaultTriggerExpressoinCombo.setEnabled(fe.getBooleanValue(), getFieldEditorParent());
    }/*  ww w.j a  va  2  s  . c o m*/
}

From source file:org.eclipse.viatra.query.tooling.ui.preferences.PatternInitializationPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    final IPreferenceStore store = EMFPatternLanguageUIPlugin.getInstance().getPreferenceStore();
    Composite control = new Composite(parent, SWT.NONE);

    Label wildcardDescriptionLabel = new Label(control, SWT.NONE | SWT.WRAP);
    wildcardDescriptionLabel.setText(WILDCARD_MODE_DESCRIPTION);
    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.horizontalAlignment = SWT.FILL;
    layoutData.widthHint = 200;/*from   ww  w. ja  v a 2  s .  c o m*/
    wildcardDescriptionLabel.setLayoutData(layoutData);
    final BooleanFieldEditor wildcardModeEditor = new BooleanFieldEditor(PreferenceConstants.WILDCARD_MODE,
            "&Wildcard mode", control);
    wildcardModeEditor.setPreferenceStore(EMFPatternLanguageUIPlugin.getInstance().getPreferenceStore());
    wildcardModeEditor.load();
    wildcardModeEditor.setPropertyChangeListener(
            event -> store.setValue(PreferenceConstants.WILDCARD_MODE, wildcardModeEditor.getBooleanValue()));

    Label dynamicEMFDescriptionLabel = new Label(control, SWT.NONE | SWT.WRAP);
    dynamicEMFDescriptionLabel.setText(DYNAMIC_EMF_MODE_DESCRIPTION);
    dynamicEMFDescriptionLabel.setLayoutData(layoutData);
    final BooleanFieldEditor dynamicEMFModeEditor = new BooleanFieldEditor(PreferenceConstants.DYNAMIC_EMF_MODE,
            "&Dynamic EMF mode", control);
    dynamicEMFModeEditor.setPreferenceStore(EMFPatternLanguageUIPlugin.getInstance().getPreferenceStore());
    dynamicEMFModeEditor.load();
    dynamicEMFModeEditor.setPropertyChangeListener(event -> store.setValue(PreferenceConstants.DYNAMIC_EMF_MODE,
            dynamicEMFModeEditor.getBooleanValue()));

    Label separator = new Label(control, SWT.HORIZONTAL | SWT.SEPARATOR);
    separator.setLayoutData(layoutData);

    Label dredDescriptionLabel = new Label(control, SWT.NONE | SWT.WRAP);
    dredDescriptionLabel.setText(DRED_MODE_DESCRIPTION);
    dredDescriptionLabel.setLayoutData(layoutData);
    final BooleanFieldEditor dredModeEditor = new BooleanFieldEditor(PreferenceConstants.DRED_MODE,
            "&Delete-and-Rederive (DRed) mode", control);
    dredModeEditor.setPreferenceStore(EMFPatternLanguageUIPlugin.getInstance().getPreferenceStore());
    dredModeEditor.load();
    dredModeEditor.setPropertyChangeListener(
            event -> store.setValue(PreferenceConstants.DRED_MODE, dredModeEditor.getBooleanValue()));

    return control;
}