Example usage for org.eclipse.jface.preference IPreferenceStore getBoolean

List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore getBoolean.

Prototype

boolean getBoolean(String name);

Source Link

Document

Returns the current value of the boolean-valued preference with the given name.

Usage

From source file:com.bdaum.zoom.ui.internal.preferences.AudioPreferencePage.java

License:Open Source License

@Override
protected void doFillValues() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    String samplingRate = preferenceStore.getString(PreferenceConstants.AUDIOSAMPLINGRATE);
    for (int i = 0; i < rateOptions.length; i++)
        if (rateOptions[i].equals(samplingRate)) {
            rateGroup.setSelection(i);// ww w . j a  v a2  s . c om
            break;
        }
    String bitDepth = preferenceStore.getString(PreferenceConstants.AUDIOBITDEPTH);
    for (int i = 0; i < bitOptions.length; i++)
        if (bitOptions[i].equals(bitDepth)) {
            bitGroup.setSelection(i);
            break;
        }
    alarmOnPromptButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.ALARMONPROMPT));
    alarmOnFinishButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.ALARMONFINISH));
}

From source file:com.bdaum.zoom.ui.internal.preferences.AutoPreferencePage.java

License:Open Source License

@Override
protected void doFillValues() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    ruleComponent.fillValues(preferenceStore.getString(PreferenceConstants.AUTORULES));
    autoButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.AUTODERIVE));
    xmpButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.APPLYXMPTODERIVATES));
    StringTokenizer st = new StringTokenizer(preferenceStore.getString(PreferenceConstants.RELATIONDETECTORS));
    while (st.hasMoreTokens()) {
        CheckboxButton button = detectorButtons.get(st.nextToken());
        if (button != null)
            button.setSelection(true);/*from w  w w.j  av  a2 s . com*/
    }
    if (relviewer != null)
        relviewer.setSelection(
                new StructuredSelection(preferenceStore.getString(PreferenceConstants.DERIVERELATIONS)));
}

From source file:com.bdaum.zoom.ui.internal.preferences.FileAssociationsPreferencePage.java

License:Open Source License

@Override
protected void doFillValues() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    exportButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.AUTOEXPORT));
    fileEditorMap.get("").setText(preferenceStore //$NON-NLS-1$
            .getString(PreferenceConstants.EXTERNALVIEWER));
    for (IMediaViewer viewer : imageViewers)
        fileEditorMap.get(viewer.getId())
                .setText(preferenceStore.getString(PreferenceConstants.EXTERNALMEDIAVIEWER + viewer.getId()));
    fillResourceTypeTable();//from  w w  w. j av a2s . co m
    if (resourceTypeTable.getItemCount() > 0)
        resourceTypeTable.setSelection(0);
    fillEditorTable();
    updateEnabledState();
    addedEditors.clear();
}

From source file:com.bdaum.zoom.ui.internal.preferences.GeneralPreferencePage.java

License:Open Source License

@Override
protected void doFillValues() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    undoField.setSelection(preferenceStore.getInt(PreferenceConstants.UNDOLEVELS));
    backupField.setSelection(preferenceStore.getInt(PreferenceConstants.BACKUPINTERVAL));
    backupGenerationsField.setSelection(
            new StructuredSelection(preferenceStore.getString(PreferenceConstants.BACKUPGENERATIONS)));
    iccViewer//from  w  w w .  j  a v  a2s .  c  om
            .setSelection(new StructuredSelection(preferenceStore.getString(PreferenceConstants.COLORPROFILE)));
    customFile = preferenceStore.getString(PreferenceConstants.CUSTOMPROFILE);
    advancedButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.ADVANCEDGRAPHICS));
    previewButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.PREVIEW));
    noiseButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.ADDNOISE));
    enlargeButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.ENLARGESMALL));
    if (displayGroup != null) {
        String s = preferenceStore.getString(PreferenceConstants.SECONDARYMONITOR);
        displayGroup.setSelection(
                PreferenceConstants.MON_ALTERNATE.equals(s) ? 2 : Boolean.parseBoolean(s) ? 1 : 0);
    }
    inactivityField.setSelection(preferenceStore.getInt(PreferenceConstants.INACTIVITYINTERVAL));
    updateViewer
            .setSelection(new StructuredSelection(preferenceStore.getString(PreferenceConstants.UPDATEPOLICY)));
    noProgressButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.NOPROGRESS));
}

From source file:com.bdaum.zoom.ui.internal.preferences.ImportPreferencePage.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//from www  .  j ava  2s.c om
protected void doFillValues() {
    BatchActivator batch = BatchActivator.getDefault();
    IRawConverter rc = batch.getCurrentRawConverter(false);
    previousRawConverter = rc;
    IPreferenceStore preferenceStore = getPreferenceStore();
    Map<String, IRawConverter> rawConverters = batch.getRawConverters();
    if (rc != null)
        rcViewer.setSelection(new StructuredSelection(rc));
    for (IRawConverter c : rawConverters.values()) {
        FileEditor fileEditor = basicsFileEditors.get(c.getId());
        if (fileEditor != null) {
            String path = preferenceStore.getString(c.getPathId());
            if (path.isEmpty()) {
                String editorName = c.getName();
                if (editorName != null) {
                    FileEditorMapping editorMapping = null;
                    for (String rf : ImageConstants.getRawFormatMap().keySet()) {
                        editorMapping = UiActivator.getDefault().getFileEditorMapping(rf);
                        if (editorMapping != null)
                            break;
                    }
                    if (editorMapping != null)
                        for (EditorDescriptor editorDescriptor : editorMapping.getEditors())
                            if (editorName.equalsIgnoreCase(editorDescriptor.getLabel())) {
                                path = editorDescriptor.getFileName();
                                break;
                            }
                }
            }
            fileEditor.setText(path);
        }
        for (IRawConverter.RawProperty prop : c.getProperties()) {
            prop.value = preferenceStore.getString(prop.id);
            Object object = optionProps.get(prop.id);
            if (object instanceof ComboViewer) {
                ComboViewer viewer = (ComboViewer) object;
                for (RawEnum rawEnum : (List<RawEnum>) viewer.getInput())
                    if (rawEnum.id.equals(prop.value)) {
                        viewer.setSelection(new StructuredSelection(rawEnum));
                        if (rawEnum.recipe) {
                            c.setUsesRecipes(rawEnum.id);
                            if (c == rc)
                                previousUsesRecipes = rawEnum.id;
                        }
                        break;
                    }
            } else if (object instanceof Spinner)
                try {
                    ((Spinner) object).setSelection(Integer.parseInt(prop.value));
                } catch (NumberFormatException e) {
                    // do nothing
                }
            else if (object instanceof Button)
                ((Button) object).setSelection(Boolean.parseBoolean(prop.value));
            else if (object instanceof Text)
                ((Text) object).setText(prop.value);
        }
    }
    if (modeviewer != null)
        modeviewer.setSelection(
                new StructuredSelection(preferenceStore.getString(PreferenceConstants.RAWIMPORT)));
    if (dngpathEditor != null)
        dngpathEditor.setText(preferenceStore.getString(PreferenceConstants.DNGCONVERTERPATH));
    if (uncompressedButton != null)
        uncompressedButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.DNGUNCOMPRESSED));
    if (linearButton != null)
        linearButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.DNGLINEAR));
    if (dngfolderField != null)
        dngfolderField.setText(preferenceStore.getString(PreferenceConstants.DNGFOLDER));
    maxSpinner.setSelection(preferenceStore.getInt(PreferenceConstants.MAXIMPORTS));
    String s = preferenceStore.getString(PreferenceConstants.DEVICEWATCH);
    deviceGroup.setSelection(PreferenceConstants.TETHERED.equals(s) ? 2 : Boolean.parseBoolean(s) ? 1 : 0);
    int tetheredShow = preferenceStore.getInt(PreferenceConstants.TETHEREDSHOW);
    tetheredGroup.setSelection(tetheredShow);
    showButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.SHOWIMPORTED));
    makerNotesButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.IMPORTMAKERNOTES));
    faceDataButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.IMPORTFACEDATA));
    if (recipeViewer != null) {
        List<String> configurations = Core.fromStringList(
                preferenceStore.getString(PreferenceConstants.RECIPEDETECTORCONFIGURATIONS), "\n"); //$NON-NLS-1$
        if (configurations != null && allDetectors != null)
            for (String conf : configurations) {
                int p = conf.indexOf(':');
                if (p > 0) {
                    String id = conf.substring(0, p);
                    for (IRecipeDetector detector : allDetectors) {
                        if (detector.getId().equals(id)) {
                            StringTokenizer st = new StringTokenizer(conf.substring(p + 1), ";"); //$NON-NLS-1$
                            while (st.hasMoreTokens()) {
                                String parm = st.nextToken();
                                int q = parm.indexOf('=');
                                if (q > 0) {
                                    IRecipeParameter parameter = detector.getParameter(parm.substring(0, q));
                                    if (parameter != null)
                                        parameter.setValue(parm.substring(q + 1));
                                }
                            }
                            break;
                        }
                    }
                }
            }
        selectedRecipeDetectors = Core
                .fromStringList(preferenceStore.getString(PreferenceConstants.RECIPEDETECTORS), "\n"); //$NON-NLS-1$
        previousRecipeDetectors = new HashSet<String>(selectedRecipeDetectors);
        recipeViewer.setInput(allDetectors);
        previousProcessRecipes = preferenceStore.getBoolean(PreferenceConstants.PROCESSRECIPES);
        processRecipesButton.setSelection(previousProcessRecipes);
        archiveRecipesButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.ARCHIVERECIPES));
    }
    deviceGroup.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            checkForTetheringHint();
        }
    });
}

From source file:com.bdaum.zoom.ui.internal.views.AbstractLightboxView.java

License:Open Source License

protected IPreferenceStore applyPreferences() {
    final IPreferenceStore preferenceStore = UiActivator.getDefault().getPreferenceStore();
    showLabelDflt = preferenceStore.getInt(PreferenceConstants.SHOWLABEL);
    labelTemplateDflt = preferenceStore.getString(PreferenceConstants.THUMBNAILTEMPLATE);
    labelFontsizeDflt = preferenceStore.getInt(PreferenceConstants.LABELFONTSIZE);
    showRotateButtons = preferenceStore.getBoolean(PreferenceConstants.SHOWROTATEBUTTONS);
    showColorCode = !PreferenceConstants.COLORCODE_NO
            .equals(preferenceStore.getString(PreferenceConstants.SHOWCOLORCODE));
    showLocation = preferenceStore.getBoolean(PreferenceConstants.SHOWLOCATION);
    String rating = preferenceStore.getString(PreferenceConstants.SHOWRATING);
    showRating = PreferenceConstants.SHOWRATING_NO.equals(rating) ? RATING_NO
            : PreferenceConstants.SHOWRATING_COUNT.equals(rating) ? RATING_COUNT : RATING_SIZE;
    showDoneMark = preferenceStore.getBoolean(PreferenceConstants.SHOWDONEMARK);
    showVoicenoteButton = preferenceStore.getBoolean(PreferenceConstants.SHOWVOICENOTE);
    showExpandCollapseButton = preferenceStore.getBoolean(PreferenceConstants.SHOWEXPANDCOLLAPSE);
    showRegions = preferenceStore.getInt(PreferenceConstants.MAXREGIONS);
    return preferenceStore;
}

From source file:com.bdaum.zoom.ui.internal.widgets.AnimatedGallery.java

License:Open Source License

protected IPreferenceStore applyPreferences() {
    final IPreferenceStore preferenceStore = UiActivator.getDefault().getPreferenceStore();
    showRotateButtons = preferenceStore.getBoolean(PreferenceConstants.SHOWROTATEBUTTONS);
    showColorCode = !PreferenceConstants.COLORCODE_NO
            .equals(preferenceStore.getString(PreferenceConstants.SHOWCOLORCODE));
    showLocation = preferenceStore.getBoolean(PreferenceConstants.SHOWLOCATION);
    String rating = preferenceStore.getString(PreferenceConstants.SHOWRATING);
    showRating = PreferenceConstants.SHOWRATING_NO.equals(rating) ? RATING_NO
            : PreferenceConstants.SHOWRATING_COUNT.equals(rating) ? RATING_COUNT : RATING_SIZE;
    showDoneMark = preferenceStore.getBoolean(PreferenceConstants.SHOWDONEMARK);
    showVoicenoteButton = preferenceStore.getBoolean(PreferenceConstants.SHOWVOICENOTE);
    showRegions = preferenceStore.getInt(PreferenceConstants.MAXREGIONS);
    return preferenceStore;
}

From source file:com.blackducksoftware.integration.eclipseplugin.common.services.PreferencesServiceTest.java

License:Apache License

@Test
public void testIndividualProjectDefaultSettings() {
    final IPreferenceStore mockPrefStore = new PreferenceStoreMock();
    final PreferencesService service = new PreferencesService(mockPrefStore);
    service.setDefaultConfig();//w  w  w.  jav a  2  s  .com
    service.setAllProjectSpecificDefaults(testProject);
    assertEquals("Black Duck scan not activated for new Java project by default",
            mockPrefStore.getBoolean(testProject), true);
}

From source file:com.blackducksoftware.integration.eclipseplugin.common.services.PreferencesServiceTest.java

License:Apache License

@Test
public void testIndividualProjectDefaultSettingsWhenActivateByDefaultFalse() {
    final IPreferenceStore mockPrefStore = new PreferenceStoreMock();
    final PreferencesService service = new PreferencesService(mockPrefStore);
    service.setDefaultConfig();/*from   www. j  av  a  2 s.c  om*/
    mockPrefStore.setValue(PreferenceNames.ACTIVATE_SCAN_BY_DEFAULT, "false");
    service.setAllProjectSpecificDefaults(testProject);
    assertEquals(
            "Scan automatically activated for new Java project even though default behavior is not to activate scan",
            mockPrefStore.getBoolean(testProject), false);
}

From source file:com.boothen.jsonedit.core.editors.JsonTextEditor.java

License:Open Source License

private void doAutoFormatOnSave() {
    IPreferenceStore store = getPreferenceStore();
    boolean autoFormatOnSave = store.getBoolean(JsonPreferenceStore.AUTO_FORMAT_ON_SAVE);
    if (autoFormatOnSave) {
        boolean spaces = store.getBoolean(JsonPreferenceStore.SPACES_FOR_TABS);
        int numSpaces = store.getInt(JsonPreferenceStore.NUM_SPACES);
        FormatTextHandler.formatText(this, spaces, numSpaces);
    }//from  w  ww.  j a va 2s.  c  o m
}