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

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

Introduction

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

Prototype

void putValue(String name, String value);

Source Link

Document

Sets the current value of the preference with the given name to the given string value without sending a property change.

Usage

From source file:au.gov.ga.earthsci.application.console.LoggingPreferenceInitializer.java

License:Apache License

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = new ScopedPreferenceStore(DefaultScope.INSTANCE, ILoggingPreferences.QUALIFIER_ID);

    store.putValue(ILoggingPreferences.LOG_LEVEL,
            ILoggingPreferences.LOG_LEVELS[LoggingConfigurator.getDefaultLoggingLevel() - 1]);
}

From source file:au.gov.ga.earthsci.bookmark.part.preferences.BookmarksPreferenceInitializer.java

License:Apache License

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = new ScopedPreferenceStore(DefaultScope.INSTANCE,
            IBookmarksPreferences.QUALIFIER_ID);

    store.putValue(IBookmarksPreferences.DEFAULT_TRANSITION_DURATION, Long.toString(3000L));
    store.putValue(IBookmarksPreferences.PLAY_BOOKMARKS_WAIT_DURATION, Long.toString(3000L));
    store.putValue(IBookmarksPreferences.ASK_LIST_DELETE_CONFIRM, "true"); //$NON-NLS-1$
}

From source file:au.gov.ga.earthsci.catalog.part.preferences.CatalogBrowserPreferenceInitializer.java

License:Apache License

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = new ScopedPreferenceStore(DefaultScope.INSTANCE,
            ICatalogBrowserPreferences.QUALIFIER_ID);

    store.putValue(ICatalogBrowserPreferences.ADD_NODE_STRUCTURE_MODE, UserActionPreference.ASK.name());
    store.putValue(ICatalogBrowserPreferences.DELETE_EMPTY_FOLDERS_MODE, UserActionPreference.ASK.name());
}

From source file:com.amazonaws.eclipse.core.ui.preferences.AwsAccountPreferencePage.java

License:Apache License

/**
 * Returns the list of account names registered. If none are registered yet,
 * returns the default one.//from   w  w w .j a v  a  2s. c om
 *
 * @param preferenceStore
 *            The preference store to use when looking up the account names.
 * @return A map of account identifier to customer-assigned names. The
 *         identifiers are the primary, immutable key used to access the
 *         account.
 */
public static Map<String, String> getAccounts(IPreferenceStore preferenceStore) {
    String accountNamesString = preferenceStore.getString(PreferenceConstants.P_ACCOUNT_IDS);

    // bootstrapping
    if (accountNamesString == null || accountNamesString.length() == 0) {
        String id = UUID.randomUUID().toString();
        preferenceStore.putValue(PreferenceConstants.P_CURRENT_ACCOUNT, id);
        preferenceStore.putValue(PreferenceConstants.P_ACCOUNT_IDS, id);
        preferenceStore.putValue(id + ":" + PreferenceConstants.P_ACCOUNT_NAME,
                PreferenceConstants.DEFAULT_ACCOUNT_NAME_BASE_64);
    }

    String[] accountIds = accountNamesString.split(PreferenceConstants.ACCOUNT_ID_SEPARATOR_REGEX);
    Map<String, String> names = new HashMap<String, String>();
    for (String id : accountIds) {
        String preferenceName = id + ":" + PreferenceConstants.P_ACCOUNT_NAME;
        names.put(id, ObfuscatingStringFieldEditor.decodeString(preferenceStore.getString(preferenceName)));
    }

    return names;
}

From source file:com.aptana.ide.core.ui.ColorPair.java

License:Open Source License

/**
 * Sets the current value of the preference with the given name in the given preference store.
 * /*from   w w w .  j  av  a  2 s.co m*/
 * @param store
 *            the preference store
 * @param name
 *            the name of the preference
 * @param value
 *            the new current value of the preference
 */
public static void setValue(IPreferenceStore store, String name, ColorPair value) {
    ColorPair oldValue = getColorPair(store, name);
    if (oldValue == null || !oldValue.equals(value)) {
        store.putValue(name, ColorPair.asString(value));
        store.firePropertyChangeEvent(name, oldValue, value);
    }
}

From source file:com.aptana.ide.core.ui.install.PlatformValidatorPatcher.java

License:Open Source License

/**
 * @param folder //  w w w  .  ja va 2  s.com
 * 
 */
private static void doExport(File folder) {
    long currentTimeMillis = System.currentTimeMillis();
    Date dt = new Date(currentTimeMillis);
    DateFormat dateInstance = DateFormat.getDateInstance(DateFormat.SHORT);
    String fDate = dateInstance.format(dt);
    fDate = StringUtils.replace(fDate, "/", "_"); //$NON-NLS-1$ //$NON-NLS-2$
    fDate = StringUtils.replace(fDate, "\\", "_"); //$NON-NLS-1$ //$NON-NLS-2$
    String fName = FileUtils.ensureValidFilename(PREF_BACKUP + fDate + ".epr"); //$NON-NLS-1$
    File fl = new File(folder, fName);
    int a = 1;
    while (fl.exists()) {
        fName = FileUtils.ensureValidFilename(PREF_BACKUP + fDate + "v" + a + ".epr"); //$NON-NLS-1$ //$NON-NLS-2$
        a++;
        fl = new File(folder, fName);
    }
    exportPreferences(fl);
    IPreferenceStore preferenceStore = CoreUIPlugin.getDefault().getPreferenceStore();
    preferenceStore.putValue(IPreferenceConstants.PREF_AUTO_BACKUP_LASTNAME, fl.getAbsolutePath());
}

From source file:com.bdaum.zoom.rcp.internal.intro.VersionChangeDetector.java

License:Open Source License

private static boolean isVersionChange() {
    IPreferenceStore preferenceStore = RcpActivator.getDefault().getPreferenceStore();
    String v = preferenceStore.getString(PreferenceConstants.PREVIOUSVERSION);
    if (v == null || v.isEmpty()) {
        preferenceStore.putValue(PreferenceConstants.PREVIOUSVERSION,
                Platform.getProduct().getDefiningBundle().getVersion().toString());
        return true;
    }//from   www .  java 2s.c o  m
    Version oldVersion = new Version(v);
    Version version = Platform.getProduct().getDefiningBundle().getVersion();
    if (version.getMajor() > oldVersion.getMajor()
            || (version.getMajor() == oldVersion.getMajor() && version.getMinor() > oldVersion.getMinor())) {
        preferenceStore.putValue(PreferenceConstants.PREVIOUSVERSION, version.toString());
        return true;
    }
    return false;
}

From source file:com.google.dart.tools.deploy.ApplicationActionBarAdvisor.java

License:Open Source License

/**
 * Creates the feature-dependent actions for the menu bar.
 *//* ww w.  j a v  a2 s . c  om*/
private void makeFeatureDependentActions(IWorkbenchWindow window) {

    IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault().getPreferenceStore();

    // Optimization: avoid obtaining the about infos if the platform state is
    // unchanged from last time.  See bug 75130 for details.
    String stateKey = "platformState"; //$NON-NLS-1$
    String prevState = prefs.getString(stateKey);
    String currentState = String.valueOf(Platform.getStateStamp());
    boolean sameState = currentState.equals(prevState);
    if (!sameState) {
        prefs.putValue(stateKey, currentState);
    }
}

From source file:com.google.dart.tools.search.internal.ui.SearchPreferencePage.java

License:Open Source License

public static String getDefaultPerspectiveId() {
    handleDeletedPerspectives();//from w  w  w .jav  a 2 s.  c o  m
    IPreferenceStore store = SearchPlugin.getDefault().getPreferenceStore();
    String id = store.getString(DEFAULT_PERSPECTIVE);
    if (id == null || id.length() == 0 || id.equals(NO_DEFAULT_PERSPECTIVE)) {
        return null;
    } else if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) {
        store.putValue(DEFAULT_PERSPECTIVE, id);
        return null;
    }
    return id;
}

From source file:com.google.dart.tools.search.internal.ui.SearchPreferencePage.java

License:Open Source License

private static void handleDeletedPerspectives() {
    IPreferenceStore store = SearchPlugin.getDefault().getPreferenceStore();
    String id = store.getString(DEFAULT_PERSPECTIVE);
    if (PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(id) == null) {
        store.putValue(DEFAULT_PERSPECTIVE, NO_DEFAULT_PERSPECTIVE);
    }/*from ww w  .  j ava2s .c o m*/
}