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

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

Introduction

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

Prototype

void setValue(String name, boolean value);

Source Link

Document

Sets 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 doPerformOk() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    int rate = rateGroup.getSelection();
    if (rate >= 0)
        preferenceStore.setValue(PreferenceConstants.AUDIOSAMPLINGRATE, rateOptions[rate]);
    int bits = bitGroup.getSelection();
    if (bits >= 0)
        preferenceStore.setValue(PreferenceConstants.AUDIOBITDEPTH, bitOptions[bits]);
    preferenceStore.setValue(PreferenceConstants.ALARMONPROMPT, alarmOnPromptButton.getSelection());
    preferenceStore.setValue(PreferenceConstants.ALARMONFINISH, alarmOnFinishButton.getSelection());
}

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

License:Open Source License

@Override
protected void doPerformOk() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.AUTORULES, ruleComponent.getResult());
    preferenceStore.setValue(PreferenceConstants.AUTODERIVE, autoButton.getSelection());
    preferenceStore.setValue(PreferenceConstants.APPLYXMPTODERIVATES, xmpButton.getSelection());
    StringBuilder sb = new StringBuilder();
    for (Map.Entry<String, CheckboxButton> entry : detectorButtons.entrySet())
        if (entry.getValue().getSelection()) {
            if (sb.length() > 0)
                sb.append(' ');
            sb.append(entry.getKey());/*w ww  .j ava 2 s .  c o m*/
        }
    preferenceStore.setValue(PreferenceConstants.RELATIONDETECTORS, sb.toString());
    if (relviewer != null) {
        IStructuredSelection selection = relviewer.getStructuredSelection();
        if (!selection.isEmpty())
            preferenceStore.setValue(PreferenceConstants.DERIVERELATIONS, (String) selection.getFirstElement());
    }
    ruleComponent.accelerate();
}

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

License:Open Source License

@Override
public void doPerformDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.AUTORULES,
            preferenceStore.getDefaultString(PreferenceConstants.AUTORULES));
    preferenceStore.setValue(PreferenceConstants.AUTODERIVE,
            preferenceStore.getDefaultBoolean(PreferenceConstants.AUTODERIVE));
    preferenceStore.setValue(PreferenceConstants.APPLYXMPTODERIVATES,
            preferenceStore.getDefaultBoolean(PreferenceConstants.APPLYXMPTODERIVATES));
    preferenceStore.setValue(PreferenceConstants.RELATIONDETECTORS,
            preferenceStore.getDefaultBoolean(PreferenceConstants.RELATIONDETECTORS));
    preferenceStore.setValue(PreferenceConstants.DERIVERELATIONS,
            preferenceStore.getDefaultString(PreferenceConstants.DERIVERELATIONS));
}

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

License:Open Source License

@Override
public void performDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.BACKGROUNDCOLOR,
            preferenceStore.getDefaultString(PreferenceConstants.BACKGROUNDCOLOR));
    preferenceStore.setValue(PreferenceConstants.AUTOCOLORCODECRIT,
            preferenceStore.getDefaultString(PreferenceConstants.AUTOCOLORCODECRIT));
}

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

License:Open Source License

@Override
public void performOk() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    IStructuredSelection selection = colorCodeViewer.getStructuredSelection();
    if (!selection.isEmpty())
        preferenceStore.setValue(PreferenceConstants.SHOWCOLORCODE, (String) selection.getFirstElement());
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < colorCodeGroups.length; i++)
        sb.append(colorCodeGroups[i].encodeCriterion()).append("\n"); //$NON-NLS-1$
    preferenceStore.setValue(PreferenceConstants.AUTOCOLORCODECRIT, sb.toString());
}

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 . ja  v  a  2  s . c  o 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.FileAssociationsPreferencePage.java

License:Open Source License

@Override
protected void doPerformDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.AUTOEXPORT,
            preferenceStore.getDefaultBoolean(PreferenceConstants.AUTOEXPORT));
    preferenceStore.setValue(PreferenceConstants.EXTERNALVIEWER,
            preferenceStore.getDefaultString(PreferenceConstants.EXTERNALVIEWER));
    preferenceStore.setValue(PreferenceConstants.FILEASSOCIATION,
            preferenceStore.getDefaultString(PreferenceConstants.FILEASSOCIATION));
}

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

License:Open Source License

@Override
protected void doPerformDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.UNDOLEVELS,
            preferenceStore.getDefaultInt(PreferenceConstants.UNDOLEVELS));
    preferenceStore.setValue(PreferenceConstants.BACKUPINTERVAL,
            preferenceStore.getDefaultInt(PreferenceConstants.BACKUPINTERVAL));
    preferenceStore.setValue(PreferenceConstants.BACKUPGENERATIONS,
            preferenceStore.getDefaultInt(PreferenceConstants.BACKUPGENERATIONS));
    preferenceStore.setValue(PreferenceConstants.CUSTOMPROFILE,
            preferenceStore.getDefaultInt(PreferenceConstants.CUSTOMPROFILE));
    preferenceStore.setValue(PreferenceConstants.COLORPROFILE,
            preferenceStore.getDefaultInt(PreferenceConstants.COLORPROFILE));
    preferenceStore.setValue(PreferenceConstants.ADVANCEDGRAPHICS,
            preferenceStore.getDefaultBoolean(PreferenceConstants.ADVANCEDGRAPHICS));
    preferenceStore.setValue(PreferenceConstants.PREVIEW,
            preferenceStore.getDefaultBoolean(PreferenceConstants.PREVIEW));
    preferenceStore.setValue(PreferenceConstants.ADDNOISE,
            preferenceStore.getDefaultBoolean(PreferenceConstants.ADDNOISE));
    preferenceStore.setValue(PreferenceConstants.ENLARGESMALL,
            preferenceStore.getDefaultBoolean(PreferenceConstants.ENLARGESMALL));
    preferenceStore.setValue(PreferenceConstants.SECONDARYMONITOR,
            preferenceStore.getDefaultString(PreferenceConstants.SECONDARYMONITOR));
    preferenceStore.setValue(PreferenceConstants.INACTIVITYINTERVAL,
            preferenceStore.getDefaultInt(PreferenceConstants.INACTIVITYINTERVAL));
    preferenceStore.setValue(PreferenceConstants.AUTOEXPORT,
            preferenceStore.getDefaultBoolean(PreferenceConstants.AUTOEXPORT));
    preferenceStore.setValue(PreferenceConstants.EXTERNALVIEWER,
            preferenceStore.getDefaultString(PreferenceConstants.EXTERNALVIEWER));
    preferenceStore.setValue(PreferenceConstants.UPDATEPOLICY,
            preferenceStore.getDefaultString(PreferenceConstants.UPDATEPOLICY));
    preferenceStore.setValue(PreferenceConstants.NOPROGRESS,
            preferenceStore.getDefaultBoolean(PreferenceConstants.NOPROGRESS));
}

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

License:Open Source License

@Override
protected void doPerformOk() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.UNDOLEVELS, undoField.getSelection());
    preferenceStore.setValue(PreferenceConstants.BACKUPINTERVAL, backupField.getSelection());
    IStructuredSelection selection = backupGenerationsField.getStructuredSelection();
    if (!selection.isEmpty())
        preferenceStore.setValue(PreferenceConstants.BACKUPGENERATIONS,
                Integer.parseInt(selection.getFirstElement().toString()));
    selection = iccViewer.getStructuredSelection();
    if (!selection.isEmpty()) {
        String iccno = (String) selection.getFirstElement();
        preferenceStore.setValue(PreferenceConstants.COLORPROFILE, iccno);
        if (Integer.parseInt(iccno) == ImageConstants.CUSTOM && customFile != null)
            preferenceStore.setValue(PreferenceConstants.CUSTOMPROFILE, customFile);
    }/*  w  w w.  j a v  a2  s  .com*/
    preferenceStore.setValue(PreferenceConstants.ADVANCEDGRAPHICS, advancedButton.getSelection());
    preferenceStore.setValue(PreferenceConstants.PREVIEW, previewButton.getSelection());
    preferenceStore.setValue(PreferenceConstants.ADDNOISE, noiseButton.getSelection());
    preferenceStore.setValue(PreferenceConstants.ENLARGESMALL, enlargeButton.getSelection());
    if (displayGroup != null) {
        int i = displayGroup.getSelection();
        preferenceStore.setValue(PreferenceConstants.SECONDARYMONITOR,
                i == 2 ? PreferenceConstants.MON_ALTERNATE : i == 1 ? "true" : "false"); //$NON-NLS-1$ //$NON-NLS-2$
    }
    preferenceStore.setValue(PreferenceConstants.INACTIVITYINTERVAL, inactivityField.getSelection());
    IStructuredSelection sel = updateViewer.getStructuredSelection();
    if (!sel.isEmpty())
        preferenceStore.setValue(PreferenceConstants.UPDATEPOLICY, sel.getFirstElement().toString());
    preferenceStore.setValue(PreferenceConstants.NOPROGRESS, noProgressButton.getSelection());
}

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

License:Open Source License

@Override
protected void doPerformOk() {
    for (Category cat : rootMap.values())
        for (HoverNode node : cat.getChildren())
            node.save();/* ww w.  j  ava2s .  c om*/
    IPreferenceStore preferenceStore = getPreferenceStore();
    preferenceStore.setValue(PreferenceConstants.HOVERDELAY, delayTimeField.getSelection());
    preferenceStore.setValue(PreferenceConstants.HOVERBASETIME, baseTimeField.getSelection());
    preferenceStore.setValue(PreferenceConstants.HOVERCHARTIME, charTimeField.getSelection());
}