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

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

Introduction

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

Prototype

int getDefaultInt(String name);

Source Link

Document

Returns the default value for the integer-valued preference with the given name.

Usage

From source file:com.nokia.carbide.cdt.builder.test.BuilderPrefConstantsTest.java

License:Open Source License

/**
 * Test PREF_CLEAN_LEVEL//from   w w w .  java  2  s.c om
 */
public void testCleanLevelPref() throws Exception {
    IPreferenceStore store = CarbideBuilderPlugin.getDefault().getPreferenceStore();
    int cleanIndex = store.getDefaultInt(BuilderPreferenceConstants.PREF_CLEAN_LEVEL);
    assertEquals(0, cleanIndex);
}

From source file:com.nokia.carbide.cdt.builder.test.BuilderPrefConstantsTest.java

License:Open Source License

/**
 * Test PREF_DEFAULT_MMP_CHANGED_ACTION (pop-up)
 *//*from ww  w .j  a  v a  2 s.c om*/
public void testMMPChangeActionSelectionPref() throws Exception {
    IPreferenceStore store = CarbideBuilderPlugin.getDefault().getPreferenceStore();
    int action = store.getDefaultInt(BuilderPreferenceConstants.PREF_DEFAULT_MMP_CHANGED_ACTION);
    assertEquals(0, action);
}

From source file:com.sureassert.uc.SaUCPreferencePage.java

License:Open Source License

/**
 * Initializes states of the controls using default values
 * in the preference store.//  www .ja  va2 s .  c  om
 */
private void initializeDefaults() {

    IPreferenceStore store = getPreferenceStore();
    SaUCPreferences.setDefaults(store);
    runJunitAutomaticallyCheckbox
            .setSelection(store.getDefaultBoolean(SaUCPreferences.PREF_KEY_JUNIT_AUTOMATION));
    junitExcludeFilterText.setText(store.getDefaultString(SaUCPreferences.PREF_KEY_JUNIT_EXCLUDE_FILTER));
    calculateCoverageCheckbox.setSelection(store.getDefaultBoolean(SaUCPreferences.PREF_KEY_COVERAGE_ENABLED));
    coverageProblemsCheckbox
            .setSelection(store.getDefaultBoolean(SaUCPreferences.PREF_KEY_COVERAGE_PROBLEMS_ENABLED));
    coverageProjectDecorationCheckbox.setSelection(
            store.getDefaultBoolean(SaUCPreferences.PREF_KEY_COVERAGE_PROJECT_DECORATION_ENABLED));
    coverageFileDecorationCheckbox
            .setSelection(store.getDefaultBoolean(SaUCPreferences.PREF_KEY_COVERAGE_FILE_DECORATION_ENABLED));
    coverageFilePercentCheckbox
            .setSelection(store.getDefaultBoolean(SaUCPreferences.PREF_KEY_COVERAGE_FILE_PERCENT_ENABLED));
    coverageDisplayEnabledCheckbox
            .setSelection(store.getDefaultBoolean(SaUCPreferences.PREF_KEY_COVERAGE_DISPLAY_ENABLED));
    coverageWarnThreshold.setSelection(store.getDefaultInt(SaUCPreferences.PREF_KEY_COVERAGE_WARN_THRESHOLD));
    coverageErrorThreshold.setSelection(store.getDefaultInt(SaUCPreferences.PREF_KEY_COVERAGE_ERROR_THRESHOLD));
    // coverageRequiredThreshold.setSelection(store.getDefaultInt(SaUCPreferences.PREF_KEY_COVERAGE_REQUIRED_THRESHOLD));
    sourceStubsEnabledCheckbox
            .setSelection(store.getDefaultBoolean(SaUCPreferences.PREF_KEY_STUBS_ALLOW_SOURCE_STUBS));
    // licenceKeyText.setText(store.getDefaultString(SaUCPreferences.PREF_KEY_LICENCE_KEY));
    // licenceEmailText.setText(store.getDefaultString(SaUCPreferences.PREF_KEY_LICENCE_EMAIL));
    // execConcurrentCheckbox.setSelection(store.getDefaultBoolean(SaUCPreferences.PREF_KEY_EXEC_CONCURRENT));
}

From source file:de.walware.ecommons.preferences.ui.OverlayPreferenceStore.java

License:Open Source License

private void loadProperty(final IPreferenceStore orgin, final OverlayStorePreference key,
        final IPreferenceStore target, final boolean forceInitialization) {

    final Type type = key.fType;
    switch (type) {

    case BOOLEAN: {
        if (forceInitialization) {
            target.setValue(key.fKey, true);
        }/*from   ww w . j  ava2 s  .c o  m*/
        target.setValue(key.fKey, orgin.getBoolean(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
        break;
    }

    case DOUBLE: {
        if (forceInitialization) {
            target.setValue(key.fKey, 1.0D);
        }
        target.setValue(key.fKey, orgin.getDouble(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
        break;
    }

    case FLOAT: {
        if (forceInitialization) {
            target.setValue(key.fKey, 1.0F);
        }
        target.setValue(key.fKey, orgin.getFloat(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
        break;
    }

    case INT: {
        if (forceInitialization) {
            target.setValue(key.fKey, 1);
        }
        target.setValue(key.fKey, orgin.getInt(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
        break;
    }

    case LONG: {
        if (forceInitialization) {
            target.setValue(key.fKey, 1L);
        }
        target.setValue(key.fKey, orgin.getLong(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
        break;
    }

    case STRING: {
        if (forceInitialization) {
            target.setValue(key.fKey, "1"); //$NON-NLS-1$
        }
        target.setValue(key.fKey, orgin.getString(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
        break;
    }
    }
}

From source file:descent.internal.ui.preferences.NewJavaProjectPreferencePage.java

License:Open Source License

protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();
    for (int i = 0; i < fCheckBoxes.size(); i++) {
        Button button = (Button) fCheckBoxes.get(i);
        String key = (String) button.getData();
        button.setSelection(store.getDefaultBoolean(key));
    }/*from  w  w  w  .  j a  va2 s .co  m*/
    for (int i = 0; i < fRadioButtons.size(); i++) {
        Button button = (Button) fRadioButtons.get(i);
        String[] info = (String[]) button.getData();
        button.setSelection(info[1].equals(store.getDefaultString(info[0])));
    }
    for (int i = 0; i < fTextControls.size(); i++) {
        Text text = (Text) fTextControls.get(i);
        String key = (String) text.getData();
        text.setText(store.getDefaultString(key));
    }
    if (fJRECombo != null) {
        fJRECombo.select(store.getDefaultInt(CLASSPATH_JRELIBRARY_INDEX));
    }

    validateFolders();
    super.performDefaults();
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.java

License:Open Source License

@Override
protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();
    for (int i = 0; i < fCheckBoxes.size(); i++) {
        Button button = fCheckBoxes.get(i);
        String key = (String) button.getData();
        button.setSelection(store.getDefaultBoolean(key));
    }//from   ww  w.  j a  va 2s . co  m
    for (int i = 0; i < fRadioButtons.size(); i++) {
        Button button = fRadioButtons.get(i);
        String[] info = (String[]) button.getData();
        button.setSelection(info[1].equals(store.getDefaultString(info[0])));
    }
    for (int i = 0; i < fTextControls.size(); i++) {
        Text text = fTextControls.get(i);
        String key = (String) text.getData();
        text.setText(store.getDefaultString(key));
    }
    if (fJRECombo != null) {
        fJRECombo.select(store.getDefaultInt(CLASSPATH_JRELIBRARY_INDEX));
    }

    validateFolders();
    super.performDefaults();
}

From source file:gov.nasa.arc.spife.europa.preferences.EuropaPreferences.java

License:Open Source License

public static int getEuropaPort() {
    IPreferenceStore store = EuropaPlugin.getDefault().getPreferenceStore();
    int port = store.getInt(EuropaPreferencePage.P_PORT);
    if (port == 0) {
        port = DEFAULT_PORT;/*from w  w  w  . jav a2s. c  om*/
        trace.warn("Europa preference port is zero. Using default: " + port);
    }
    if (Level.DEBUG.isGreaterOrEqual(trace.getEffectiveLevel())) {
        trace.debug("port: " + store.getInt(EuropaPreferencePage.P_PORT) + "  default: "
                + store.getDefaultInt(EuropaPreferencePage.P_PORT));
    }
    return port;
}

From source file:gov.redhawk.ui.port.nxmplot.preferences.Preference.java

License:Open Source License

public T getDefaultValue(IPreferenceStore store) {
    if (store != null) {
        if (type == Boolean.class) {
            return type.cast(store.getDefaultBoolean(name));
        } else if (type == Double.class) {
            return type.cast(store.getDefaultDouble(name));
        } else if (type == Float.class) {
            return type.cast(store.getDefaultFloat(name));
        } else if (type == Integer.class) {
            return type.cast(store.getDefaultInt(name));
        } else if (type == Long.class) {
            return type.cast(store.getDefaultLong(name));
        } else if (type == String.class) {
            return type.cast(store.getDefaultString(name));
        } else {//from   w  ww.  j ava 2  s . c  o m
            throw new IllegalStateException("Unsupported preference type " + type.getCanonicalName());
        }
    } else {
        return null;
    }
}

From source file:isabelle.eclipse.ui.preferences.OverlayPreferenceStore.java

License:Open Source License

/**
 * Loads the given key from the orgin into the target.
 *
 * @param orgin the source preference store
 * @param key the overlay key/*from   w w w.ja v  a 2s . co  m*/
 * @param target the preference store to which the key is propagated
 * @param forceInitialization if <code>true</code> the value in the target gets initialized before loading
 */
private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target,
        boolean forceInitialization) {
    TypeDescriptor d = key.fDescriptor;
    if (BOOLEAN == d) {

        if (forceInitialization)
            target.setValue(key.fKey, true);
        target.setValue(key.fKey, orgin.getBoolean(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));

    } else if (DOUBLE == d) {

        if (forceInitialization)
            target.setValue(key.fKey, 1.0D);
        target.setValue(key.fKey, orgin.getDouble(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));

    } else if (FLOAT == d) {

        if (forceInitialization)
            target.setValue(key.fKey, 1.0F);
        target.setValue(key.fKey, orgin.getFloat(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));

    } else if (INT == d) {

        if (forceInitialization)
            target.setValue(key.fKey, 1);
        target.setValue(key.fKey, orgin.getInt(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));

    } else if (LONG == d) {

        if (forceInitialization)
            target.setValue(key.fKey, 1L);
        target.setValue(key.fKey, orgin.getLong(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));

    } else if (STRING == d) {

        if (forceInitialization)
            target.setValue(key.fKey, "1"); //$NON-NLS-1$
        target.setValue(key.fKey, orgin.getString(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));

    }
}

From source file:melnorme.util.swt.jface.preference.OverlayPreferenceStore.java

License:Open Source License

protected void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target,
        boolean forceInitialization) {
    TypeDescriptor d = key.fDescriptor;/*from w w  w .j  a v  a 2 s . com*/
    if (BOOLEAN == d) {
        if (forceInitialization)
            target.setValue(key.fKey, true);
        target.setValue(key.fKey, orgin.getBoolean(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
    } else if (DOUBLE == d) {
        if (forceInitialization)
            target.setValue(key.fKey, 1.0D);
        target.setValue(key.fKey, orgin.getDouble(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
    } else if (FLOAT == d) {
        if (forceInitialization)
            target.setValue(key.fKey, 1.0F);
        target.setValue(key.fKey, orgin.getFloat(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
    } else if (INT == d) {
        if (forceInitialization)
            target.setValue(key.fKey, 1);
        target.setValue(key.fKey, orgin.getInt(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
    } else if (LONG == d) {
        if (forceInitialization)
            target.setValue(key.fKey, 1L);
        target.setValue(key.fKey, orgin.getLong(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
    } else if (STRING == d) {
        if (forceInitialization)
            target.setValue(key.fKey, "1"); //$NON-NLS-1$
        target.setValue(key.fKey, orgin.getString(key.fKey));
        target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
    }
}