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.microsoft.tfs.client.common.ui.teambuild.prefs.BuildNotificationPreferencePage.java

License:Open Source License

@Override
public boolean performOk() {
    final int refreshTime = getRefreshInterval();

    if (refreshTime < 1) {
        return false;
    }/*  w  w  w.ja v a  2s.c  o m*/

    // TODO see TODO in initializeValues()

    final Preferences nonUIPrefs = TFSCommonClientPlugin.getDefault().getPluginPreferences();

    nonUIPrefs.setValue(PreferenceConstants.BUILD_STATUS_REFRESH_INTERVAL, refreshTime);

    TFSCommonClientPlugin.getDefault().savePluginPreferences();

    // Back to normal UI prefs

    final IPreferenceStore uiPrefs = TFSCommonUIClientPlugin.getDefault().getPreferenceStore();

    uiPrefs.setValue(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS, notifyBuildSuccessButton.getSelection());
    uiPrefs.setValue(UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED,
            notifyBuildPartiallySucceededButton.getSelection());
    uiPrefs.setValue(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE, notifyBuildFailureButton.getSelection());

    final TFSServer currentServer = TFSCommonUIClientPlugin.getDefault().getProductPlugin().getServerManager()
            .getDefaultServer();

    if (currentServer != null) {
        currentServer.getBuildStatusManager().setRefreshInterval(refreshTime);
    }

    return super.performOk();
}

From source file:com.microsoft.tfs.client.common.ui.views.PendingChangesView.java

License:Open Source License

private void toggleHideTextOnButtonsOption() {
    final IPreferenceStore preferences = TFSCommonUIClientPlugin.getDefault().getPreferenceStore();
    final boolean currentValue = preferences
            .getBoolean(UIPreferenceConstants.HIDE_TEXT_IN_PENDING_CHANGE_VIEW_BUTTONS);
    preferences.setValue(UIPreferenceConstants.HIDE_TEXT_IN_PENDING_CHANGE_VIEW_BUTTONS, !currentValue);
}

From source file:com.microsoft.tfs.client.eclipse.ui.prefs.OfflinePreferencePage.java

License:Open Source License

@Override
public boolean performOk() {
    final IPreferenceStore store = getPreferenceStore();

    store.setValue(UIPreferenceConstants.DETECT_LOCAL_CHANGES_ON_MANUAL_RECONNECT,
            detectChangesOnManualReconnectButton.getSelection());
    store.setValue(UIPreferenceConstants.DETECT_LOCAL_CHANGES_ON_AUTOMATIC_RECONNECT,
            detectChangesOnAutomaticReconnectButton.getSelection());

    store.setValue(UIPreferenceConstants.RECONNECT_PROJECTS_TO_NEW_REPOSITORIES,
            reconnectAutomaticallyButton.getSelection());

    return true;//from ww  w . j ava  2 s .c o  m
}

From source file:com.mobilesorcery.sdk.core.CoreMoSyncPlugin.java

License:Open Source License

/**
 * Sets the preferred launcher for a given packager.
 * @param packager//ww w. j  av  a 2 s .c om
 * @param launcherId {@code null} if no preferred launcher should be set
 */
public void setPreferredLauncher(String packager, String launcherId) {
    IPreferenceStore store = getPreferenceStore();
    String pref = PREFERRED_LAUNCER_PREF_PREFIX + packager;
    if (launcherId == null) {
        store.setToDefault(pref);
    } else {
        store.setValue(pref, launcherId);
    }
}

From source file:com.mobilesorcery.sdk.ui.editors.resources.SyntaxColoringPreference.java

License:Open Source License

public void storeTo(IPreferenceStore preferences) {
    PreferenceConverter.setValue(preferences, name + FG_SUFFIX, foreground);
    PreferenceConverter.setValue(preferences, name + BG_SUFFIX, background);
    preferences.setValue(name + BOLD_SUFFIX, bold);
    preferences.setValue(name + ITALIC_SUFFIX, italic);
    preferences.setValue(name + UNDERLINE_SUFFIX, underline);
    preferences.setValue(name + STRIKETHROUGH_SUFFIX, strikethrough);
}

From source file:com.motorola.studio.android.common.preferences.DialogWithToggleUtils.java

License:Apache License

/**
 * Set a preference key to a certain value
 * This key is used to toggle dialogs. Do not use it for general proposes
 * @param preferenceKey/*www.j a va  2  s . co m*/
 * @param value
 */
public static void setToggleDialogPreferenceKey(final String preferenceKey, final String value) {
    final String prefKey = preferenceKey + TOGGLE_DIALOG;
    AbstractUIPlugin plugin = CommonPlugin.getDefault();
    IPreferenceStore store = plugin.getPreferenceStore();

    store.setValue(prefKey, value);
}

From source file:com.motorolamobility.preflighting.ui.tabs.CheckersTabComposite.java

License:Apache License

/**
 * Saved extended properties. The extended properties are related to
 * a checker or condition, and are saved in the form:
 * <id>,<extended_property>;<id>,<extended_property>...
 * /*from  w  w  w  . ja  v  a  2 s.c om*/
 * The properties come from a map <id> -> <extended_property>
 * 
 * @param map a map with the extended properties
 * @param preferenceStore the preference store
 * @param preferenceName the preference key used to store
 */
private void saveExtendedProperty(Map<String, ?> map, IPreferenceStore preferenceStore, String preferenceName) {
    StringBuilder stringBuilder = new StringBuilder();
    if (!map.isEmpty()) {
        for (String id : map.keySet()) {
            String params = ((map.get(id) != null) ? map.get(id).toString() : null);
            if ((params != null) && (params.length() > 0)) {
                stringBuilder.append(id);
                stringBuilder.append(","); //$NON-NLS-1$
                stringBuilder.append(params);
                stringBuilder.append(";"); //$NON-NLS-1$
            }
        }
        deleteLastChar(stringBuilder);
    }
    preferenceStore.setValue(preferenceName, stringBuilder.toString());
}

From source file:com.motorolamobility.preflighting.ui.tabs.CheckersTabComposite.java

License:Apache License

@Override
public void performOk(IPreferenceStore preferenceStore) {
    StringBuilder stringBuilder;/*  w w  w .  ja  v a 2  s  .c o m*/

    /*
     * Checkers information
     */
    Object[] checkerDescriptions = checkersTableViewer.getCheckedElements();

    stringBuilder = new StringBuilder();
    if (checkerDescriptions.length > 0) {
        for (Object checkerDescObj : checkerDescriptions) {
            CheckerDescription checkerDescription = (CheckerDescription) checkerDescObj;
            stringBuilder.append(checkerDescription.getId());
            stringBuilder.append(","); //$NON-NLS-1$
        }
        deleteLastChar(stringBuilder);
        preferenceStore.putValue(PreflightingUIPlugin.CHECKERS_PREFERENCE_KEY, stringBuilder.toString());
    } else {
        preferenceStore.putValue(PreflightingUIPlugin.CHECKERS_PREFERENCE_KEY, NO_CHECKERS_SELECTED);
    }

    stringBuilder = new StringBuilder();
    if (!selectedConditionsMap.isEmpty()) {
        for (String checkerId : selectedConditionsMap.keySet()) {
            stringBuilder.append(checkerId);
            stringBuilder.append(":");
            for (Condition condition : selectedConditionsMap.get(checkerId)) {
                stringBuilder.append(condition.getId());
                stringBuilder.append(","); //$NON-NLS-1$
            }
            deleteLastChar(stringBuilder);
            stringBuilder.append(";");
        }
        deleteLastChar(stringBuilder);
    }
    preferenceStore.setValue(PreflightingUIPlugin.CHECKERS_CONDITIONS_PREFERENCE_KEY, stringBuilder.toString());

    /*
     * Extended Properties
     */
    // Checker parameters
    saveExtendedProperty(checkerParams, preferenceStore, PreflightingUIPlugin.CHECKERS_PARAMS_PREFERENCE_KEY);
    // Custom checker warning levels
    saveExtendedProperty(customCheckersWarningLevels, preferenceStore,
            PreflightingUIPlugin.CHECKERS_WARNING_LEVELS_PREFERENCE_KEY);
    // Custom conditions warning levels
    saveExtendedProperty(customConditionsWarningLevels, preferenceStore,
            PreflightingUIPlugin.CHECKERS_CONDITIONS_WARNING_LEVELS_PREFERENCE_KEY);

}

From source file:com.motorolamobility.preflighting.ui.tabs.DevicesTabComposite.java

License:Apache License

@Override
public void performOk(IPreferenceStore preferenceStore) {
    Object[] elements = devicesTableViewer.getCheckedElements();
    //Build the comma separated list with all checked devices ids
    StringBuilder stringBuilder = new StringBuilder();
    for (Object element : elements) {
        DeviceSpecification deviceSpec = (DeviceSpecification) element;
        stringBuilder.append(deviceSpec.getId());
        stringBuilder.append(","); //$NON-NLS-1$
    }//from w  ww . jav a  2s . c o m
    //Remove the last comma.
    if (stringBuilder.length() > 0) {
        stringBuilder.deleteCharAt(stringBuilder.length() - 1);
    } else if (stringBuilder.length() == 0) {
        stringBuilder.append(NO_DEVICE_SELECTED);
    }

    preferenceStore.setValue(PreflightingUIPlugin.DEVICES_PREFERENCE_KEY, stringBuilder.toString());
    preferenceStore.setValue(PreflightingUIPlugin.USE_ALL_DEVICES_PREFERENCE_KEY,
            selectAllCheck.getSelection());

}

From source file:com.motorolamobility.preflighting.ui.tabs.GeneralSettingsComposite.java

License:Apache License

@Override
public void performOk(IPreferenceStore preferenceStore) {
    preferenceStore.setValue(PreflightingUIPlugin.OUTPUT_LIMIT_VALUE, limitText.getText());

    preferenceStore.setValue(PreflightingUIPlugin.OUTPUT_TYPE_VALUE, String.valueOf(outputTypeSelection));

    preferenceStore.setValue(PreflightingUIPlugin.WARNING_LEVEL_VALUE,
            String.valueOf(warningCombo.getSelectionIndex()));

    preferenceStore.setValue(PreflightingUIPlugin.VERBOSITY_LEVEL_VALUE,
            String.valueOf(verbosityCombo.getSelectionIndex()));

    preferenceStore.setValue(PreflightingUIPlugin.ECLIPSE_PROBLEM_TO_WARNING_VALUE,
            Boolean.toString(eclipseProblemToWarningButton.getSelection()));

}