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

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

Introduction

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

Prototype

boolean contains(String name);

Source Link

Document

Returns whether the named preference is known to this preference store.

Usage

From source file:com.nokia.carbide.cpp.internal.qt.core.QtSDKUtils.java

License:Open Source License

/**
 * Update the internal list of Qt-SDKs found in the Qt global preferences
 *///from w  w w. j  ava2  s  .  c  o  m
static void refreshQtStoredSDKs() {
    synchronized (qtSDKList) {
        qtSDKList.clear();

        IPreferenceStore store = QtProjectPlugin.getDefault().getPreferenceStore();
        int count = store.getInt(PreferenceConstants.QTVERSION_COUNT);
        for (int i = 0; i < count; i++) {
            String nameKey = PreferenceConstants.QTVERSION_NAME + "." + Integer.toString(i);
            String binpathKey = PreferenceConstants.QTVERSION_BINPATH + "." + Integer.toString(i);
            String includepathKey = PreferenceConstants.QTVERSION_INCLUDEPATH + "." + Integer.toString(i);
            String name = "";
            String binPath = "";
            String incPath = "";
            if (store.contains(nameKey)) {
                name = store.getString(nameKey);
            }
            if (store.contains(binpathKey)) {
                binPath = store.getString(binpathKey);
            }
            if (store.contains(includepathKey)) {
                incPath = store.getString(includepathKey);
            }

            QtSDK qtSDK = new QtSDK(name, incPath, binPath);
            qtSDKList.add(qtSDK);
        }
    }
}

From source file:com.nokia.carbide.cpp.project.core.tests.QtPropertiesTest.java

License:Open Source License

/**
 * Check and see if an SDK exists by name and return its zero-based index. Return -1 if not found.
 * @return/*www  .  j  a va 2  s.  c o m*/
 */
private int findSDKByName(IPreferenceStore store, String sdkName) {
    int foundIndex = -1;

    int count = store.getInt(PreferenceConstants.QTVERSION_COUNT);
    for (int i = 0; i < count; i++) {
        String nameKey = PreferenceConstants.QTVERSION_NAME + "." + Integer.toString(i);
        String binpathKey = PreferenceConstants.QTVERSION_BINPATH + "." + Integer.toString(i);
        String includepathKey = PreferenceConstants.QTVERSION_INCLUDEPATH + "." + Integer.toString(i);
        String name = "";
        //String binpath = "";
        //String includepath = "";
        if (store.contains(nameKey)) {
            name = store.getString(nameKey);
            if (name.equalsIgnoreCase(sdkName)) {
                foundIndex = i;
                break;
            }
        }
    }

    return foundIndex;
}

From source file:com.nokia.carbide.remoteconnections.RemoteConnectionsActivator.java

License:Open Source License

private void storeAgentRunningStates() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    for (IDeviceDiscoveryAgent agent : discoveryAgents) {
        String agentKey = AGENT_STATE_KEY_PREFIX + agent.getId();
        if (!preferenceStore.contains(agentKey))
            preferenceStore.setDefault(agentKey, true);
        preferenceStore.setValue(agentKey, agent.isRunning());
    }/*from www  .  java  2s .com*/
    try {
        new InstanceScope().getNode(PLUGIN_ID).flush();
    } catch (BackingStoreException e) {
        logError(e);
    }
}

From source file:com.telink.tc32eclipse.core.paths.SystemPathHelper.java

License:Open Source License

/**
 * Clear both the instance and the persistent system path cache.
 * <p>/*from w  w  w.jav a 2  s.  c o  m*/
 * This method is currently not used in the plugin.
 * </p>
 */
public synchronized static void clearCache() {

    // Clear the instance cache
    fPathCache.clear();

    // Clear the persistent cache
    IPreferenceStore prefs = TC32PathsPreferences.getPreferenceStore();
    for (TC32Path TC32path : TC32Path.values()) {
        if (prefs.contains(CACHE_TAG + TC32path.name())) {
            prefs.setToDefault(CACHE_TAG + TC32path.name());
        }
    }
}

From source file:com.worldline.asciidoctools.editor.internal.AsciidocEditor.java

License:Open Source License

public void refreshLayout() {

    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    boolean verticalSplit = preferenceStore.getBoolean("verticalSplit");
    int editorRatio = preferenceStore.contains("editorRatio") ? preferenceStore.getInt("editorRatio") : 50;

    if (verticalSplit) {
        this.tiltButton.setToolTipText("Switch To Horizontal Split");
        this.verticalScale.setVisible(false);
        this.verticalScale.setToolTipText("");
        this.horizontalScale.setVisible(true);
        this.horizontalScale.setToolTipText(String.format("Edition Display Ratio: %s%%", editorRatio));
        FormDataBuilder.on(tiltButton).bottom().left().top(editionZone);
        FormDataBuilder.on(refreshButton).bottom().right().top(editionZone);
        FormDataBuilder.on(horizontalScale).bottom().left(tiltButton).right(refreshButton);
        FormDataBuilder.on(editionZone).left().right(editorRatio).top().bottom(horizontalScale);
        FormDataBuilder.on(renderingZone).left(editorRatio).right().top().bottom(horizontalScale);
    } else {//from   ww w.java  2  s.c o  m
        this.tiltButton.setToolTipText("Switch To Vertical Split");
        this.verticalScale.setVisible(true);
        this.verticalScale.setToolTipText(String.format("Edition Display Ratio: %s%%", editorRatio));
        this.horizontalScale.setVisible(false);
        this.horizontalScale.setToolTipText("");
        FormDataBuilder.on(tiltButton).top().right().left(editionZone);
        FormDataBuilder.on(refreshButton).bottom().right().left(editionZone);
        FormDataBuilder.on(verticalScale).right().top(tiltButton).bottom(refreshButton);
        FormDataBuilder.on(editionZone).left().right(verticalScale).top().bottom(editorRatio);
        FormDataBuilder.on(renderingZone).left().right(verticalScale).bottom().top(editorRatio);
    }

    this.verticalScale.setSelection(editorRatio);
    this.horizontalScale.setSelection(editorRatio);

    // this.background.update();
    this.background.layout(true);
}

From source file:com.xored.glance.internal.ui.preferences.TreeColors.java

License:Open Source License

private static RGB createColor(IPreferenceStore store, String key) {
    RGB rgb = null;// w  ww .ja va2s.  com
    if (store.contains(key)) {
        if (store.isDefault(key)) {
            rgb = PreferenceConverter.getDefaultColor(store, key);
        } else {
            rgb = PreferenceConverter.getColor(store, key);
        }
        return rgb;
    }
    return null;
}

From source file:de.akra.idocit.core.services.impl.EclipsePersistenceService.java

License:Apache License

/**
 * //ww w.  j a  v a 2s.c om
 * @return true, if the {@link IPreferenceStore} of Eclipse is loaded and it contains
 *         a value for {@link PreferenceStoreConstants#ADDRESSEES}.
 */
@Override
public boolean areAddresseesInitialized() {
    IPreferenceStore prefStore = PlatformUI.getPreferenceStore();

    return prefStore.contains(PreferenceStoreConstants.ADDRESSEES)
            && !"".equals(prefStore.getString(PreferenceStoreConstants.ADDRESSEES));
}

From source file:de.akra.idocit.core.services.impl.EclipsePersistenceService.java

License:Apache License

/**
 * /* w  ww. j  a v a  2s . com*/
 * @return true, if the {@link IPreferenceStore} of Eclipse is loaded and it contains
 *         a value for {@link PreferenceStoreConstants#THEMATIC_ROLES}.
 */
@Override
public boolean areThematicRolesInitialized() {
    IPreferenceStore prefStore = PlatformUI.getPreferenceStore();

    return prefStore.contains(PreferenceStoreConstants.THEMATIC_ROLES)
            && !"".equals(prefStore.getString(PreferenceStoreConstants.THEMATIC_ROLES));
}

From source file:de.defmacro.dandelion.internal.preferences.LispPreferences.java

License:Open Source License

/**
 * Laedt den Hash-Wert des Default-Server.
 * @return Hash-Wert Default-Server//from w w w.ja va  2  s. co  m
 */
public static Integer loadDefaultServer() {
    IPreferenceStore store = LispPluginActivator.getDefault().getPreferenceStore();
    if (!store.contains(P_EVAL_SERVER_DEFAULT)) {
        return null;
    }
    return store.getInt(P_EVAL_SERVER_DEFAULT);
}

From source file:de.innot.avreclipse.core.paths.SystemPathHelper.java

License:Open Source License

/**
 * Clear both the instance and the persistent system path cache.
 * <p>/*w w  w . jav  a2s  .c o  m*/
 * This method is currently not used in the plugin.
 * </p>
 */
public synchronized static void clearCache() {

    // Clear the instance cache
    fPathCache.clear();

    // Clear the persistent cache
    IPreferenceStore prefs = AVRPathsPreferences.getPreferenceStore();
    for (AVRPath avrpath : AVRPath.values()) {
        if (prefs.contains(CACHE_TAG + avrpath.name())) {
            prefs.setToDefault(CACHE_TAG + avrpath.name());
        }
    }
}