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

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

Introduction

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

Prototype

String getString(String name);

Source Link

Document

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

Usage

From source file:com.bdaum.zoom.ui.internal.hover.AbstractHoverContribution.java

License:Open Source License

@Override
public String getTitleTemplate() {
    IPreferenceStore preferenceStore = UiActivator.getDefault().getPreferenceStore();
    return preferenceStore.getString(id + ".title.template"); //$NON-NLS-1$
}

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

License:Open Source License

@Override
protected void doFillValues() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    theme = preferenceStore.getString(PreferenceConstants.BACKGROUNDCOLOR);
    colorViewer.setSelection(new StructuredSelection(theme));
    distViewer//from www  . j a  v  a2 s  . com
            .setSelection(new StructuredSelection(preferenceStore.getString(PreferenceConstants.DISTANCEUNIT)));
    dimViewer.setSelection(new StructuredSelection(preferenceStore.getString(PreferenceConstants.DIMUNIT)));
    locationButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.SHOWLOCATION));
    doneButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.SHOWDONEMARK));
    regionField.setSelection(preferenceStore.getInt(PreferenceConstants.MAXREGIONS));
    String rating = preferenceStore.getString(PreferenceConstants.SHOWRATING);
    int r = 1;
    for (int i = 0; i < ratingOptions.length; i++)
        if (ratingOptions[i].equals(rating)) {
            r = i;
            break;
        }
    showRatingGroup.setSelection(r);
    rotateButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.SHOWROTATEBUTTONS));
    voiceNoteButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.SHOWVOICENOTE));
    expandButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.SHOWEXPANDCOLLAPSE));
    labelConfigGroup.setSelection(preferenceStore.getInt(PreferenceConstants.SHOWLABEL),
            preferenceStore.getString(PreferenceConstants.THUMBNAILTEMPLATE),
            preferenceStore.getInt(PreferenceConstants.LABELFONTSIZE));
    updateButtons();
}

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

License:Open Source License

@Override
protected void doFillValues() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    menuButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.HIDE_MENU_BAR));
    statusButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.HIDE_STATUS_BAR));
    String mode = preferenceStore.getString(PreferenceConstants.TRAY_MODE);
    trayButtonGroup.setSelection(PreferenceConstants.TRAY_PROMPT.equals(mode) ? 2
            : PreferenceConstants.TRAY_TRAY.equalsIgnoreCase(mode) ? 0 : 1);
    trashButton.setSelection(preferenceStore.getBoolean(PreferenceConstants.FORCEDELETETRASH));
}

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);/*from www .jav a  2 s  .c  o  m*/
            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);// w  ww  .ja v a  2 s  . c om
    }
    if (relviewer != null)
        relviewer.setSelection(
                new StructuredSelection(preferenceStore.getString(PreferenceConstants.DERIVERELATIONS)));
}

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

License:Open Source License

@Override
public void fillValues() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    colorCodeViewer.setSelection(//w ww.  j av a 2  s .  c  om
            new StructuredSelection(preferenceStore.getString(PreferenceConstants.SHOWCOLORCODE)));
    updateAutoGroup();
    String[] tokens = new String[colorCodeGroups.length];
    String s = preferenceStore.getString(PreferenceConstants.AUTOCOLORCODECRIT);
    if (s != null) {
        int i = 0;
        int off = 0;
        while (i < colorCodeGroups.length) {
            int p = s.indexOf('\n', off);
            if (p < 0)
                break;
            tokens[i++] = s.substring(off, p);
            off = p + 1;
        }
    }
    for (int i = 0; i < colorCodeGroups.length; i++)
        colorCodeGroups[i].fillValues(tokens[i]);
}

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  a  v a  2  s . com*/
    if (resourceTypeTable.getItemCount() > 0)
        resourceTypeTable.setSelection(0);
    fillEditorTable();
    updateEnabledState();
    addedEditors.clear();
}

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

License:Open Source License

@Override
protected void doPerformOk() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.AUTOEXPORT, exportButton.getSelection());
    preferenceStore.setValue(PreferenceConstants.EXTERNALVIEWER, fileEditorMap.get("").getText()); //$NON-NLS-1$
    for (IMediaViewer viewer : imageViewers)
        preferenceStore.setValue(PreferenceConstants.EXTERNALMEDIAVIEWER + viewer.getId(),
                fileEditorMap.get(viewer.getId()).getText());
    TableItem[] items = resourceTypeTable.getItems();
    FileEditorMapping[] mappings = new FileEditorMapping[items.length];
    for (int i = 0; i < items.length; i++)
        mappings[i] = (FileEditorMapping) (items[i].getData());
    saveMappings(mappings);/*from w w  w .  j  a va 2s . co  m*/
    File currentModule = null;
    IRawConverter rc = BatchActivator.getDefault().getCurrentRawConverter(false);
    if (rc != null) {
        String pathId = rc.getPathId();
        if (pathId != null) {
            String path = preferenceStore.getString(pathId);
            if (path != null && path.length() != 0)
                currentModule = new File(path);
        }
    }
    if (currentModule != null && !currentModule.exists())
        currentModule = null;
    for (EditorDescriptor editor : addedEditors) {
        File editorFile = new File(editor.getPath());
        if (rc != null) {
            File moduleFile = rc.findModule(editorFile.getParentFile());
            if (moduleFile != null && !moduleFile.equals(currentModule)) {
                String msg = NLS.bind(Messages.getString("FileAssociationsPreferencePage.use_dcraw_of_editor"), //$NON-NLS-1$
                        editorFile.getName(), Constants.APPLICATION_NAME);
                if (currentModule != null)
                    msg += NLS.bind(Messages.getString("FileAssociationsPreferencePage.current_module"), //$NON-NLS-1$
                            currentModule);
                else if (!Constants.LINUX)
                    msg += NLS.bind(Messages.getString("FileAssociationsPreferencePage.embedded_module"), //$NON-NLS-1$
                            Constants.APPNAME);
                else
                    msg += Messages.getString("FileAssociationsPreferencePage.os_module"); //$NON-NLS-1$
                if (AcousticMessageDialog.openQuestion(getShell(),
                        Messages.getString("FileAssociationsPreferencePage.dcraw_asso"), //$NON-NLS-1$
                        msg)) {
                    preferenceStore.setValue(rc.getPathId(), moduleFile.getAbsolutePath());
                    break;
                }
            }
        }
    }
}

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 . java  2s .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  w  w  w .  j  av  a2  s  . c o  m*/
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();
        }
    });
}