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

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

Introduction

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

Prototype

String getDefaultString(String name);

Source Link

Document

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

Usage

From source file:ar.com.tadp.xml.rinzo.jdt.preferences.ClassAttribute.java

License:Open Source License

public static List<ClassAttribute> loadFromPreference(boolean defaults) {
    IPreferenceStore store = RinzoJDTPlugin.getDefault().getPreferenceStore();
    String value = null;// w w  w . j av a 2s  .  c  o  m
    if (defaults) {
        value = store.getDefaultString(RinzoJDTPlugin.PREF_CLASSNAME_ATTRS);
    } else {
        value = store.getString(RinzoJDTPlugin.PREF_CLASSNAME_ATTRS);
    }
    List<ClassAttribute> list = new ArrayList<ClassAttribute>();
    if (value != null) {
        String[] values = value.split("\n");
        for (int i = 0; i < values.length; i++) {
            String[] split = values[i].split(FileUtils.TAB);
            if (split.length == 3) {
                list.add(new ClassAttribute(split[0], split[1], split[2]));
            }
        }
    }
    return list;
}

From source file:ar.com.tadp.xml.rinzo.jdt.preferences.ClassElement.java

License:Open Source License

public static List<ClassElement> loadFromPreference(boolean defaults) {
    IPreferenceStore store = RinzoJDTPlugin.getDefault().getPreferenceStore();
    String value = null;//from   w w  w . j  ava  2  s. co  m
    if (defaults) {
        value = store.getDefaultString(RinzoJDTPlugin.PREF_CLASSNAME_ELEMENTS);
    } else {
        value = store.getString(RinzoJDTPlugin.PREF_CLASSNAME_ELEMENTS);
    }
    List<ClassElement> list = new ArrayList<ClassElement>();
    if (value != null) {
        String[] values = value.split("\n");
        for (int i = 0; i < values.length; i++) {
            String[] split = values[i].split(FileUtils.TAB);
            if (split.length == 2) {
                list.add(new ClassElement(split[0], split[1]));
            }
        }
    }
    return list;
}

From source file:ccw.preferences.OverlayPreferenceStore.java

License:Open Source License

private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target,
        boolean forceInitialization) {
    TypeDescriptor d = key.fDescriptor;//from   ww  w .  j  a  v  a  2 s .c o  m
    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:com.aerospike.core.CoreActivator.java

License:Apache License

public static String getSeedHost(IProject project) {
    String seedHost = "127.0.0.1";
    try {/*www . ja va 2s .co  m*/
        seedHost = project.getPersistentProperty(CoreActivator.SEED_NODE_PROPERTY);
        if (seedHost == null || seedHost.isEmpty()) {
            IPreferenceStore store = getDefault().getPreferenceStore();
            seedHost = store.getDefaultString(PreferenceConstants.SEED_NODE);
            project.setPersistentProperty(CoreActivator.SEED_NODE_PROPERTY, seedHost);
        }
    } catch (CoreException e) {
        CoreActivator.log(Status.ERROR, "Error getting SEED_NODE_PROPERTY", e);
    }
    return seedHost;
}

From source file:com.amalto.workbench.preferences.SSLPreferences.java

License:Open Source License

@Override
protected void performDefaults() {
    IPreferenceStore store = getPreferenceStore();

    comboSelect(sslAlgorithmCombo, store.getDefaultString(PreferenceConstants.SSL_Algorithm));
    setRadioValue(store.getDefaultBoolean(PreferenceConstants.VERIFY_HOSTNAME));

    keyPath.setText(store.getDefaultString(PreferenceConstants.KEYSTORE_FILE));
    keyPassword.setText(store.getDefaultString(PreferenceConstants.KEYSTORE_PASSWORD));
    comboSelect(keyType, store.getDefaultString(PreferenceConstants.KEYSTORE_TYPE));

    trustPath.setText(store.getDefaultString(PreferenceConstants.TRUSTSTORE_PASSWORD));
    trustPassword.setText(store.getDefaultString(PreferenceConstants.TRUSTSTORE_PASSWORD));
    comboSelect(trustType, store.getDefaultString(PreferenceConstants.TRUSTSTORE_TYPE));

    super.performDefaults();
}

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

License:Open Source License

/**
 * Returns the default value for the color-valued preference with the given name in the given
 * preference store. Returns the default-default value (<code>COLOR_DEFAULT_DEFAULT</code>)
 * is no default preference with the given name, or if the default value cannot be treated as a
 * color./*  ww  w. j  av a 2s .c om*/
 * 
 * @param store
 *            the preference store
 * @param name
 *            the name of the preference
 * @return the default value of the preference
 */
public static ColorPair getDefaultColorPair(IPreferenceStore store, String name) {
    return basicGetColorPair(store.getDefaultString(name));
}

From source file:com.aptana.ide.core.ui.preferences.FileExtensionPreferencePage.java

License:Open Source License

/**
 * Fills the resource type table with the default preference value
 *//*from  ww w . jav a 2s .com*/
protected void fillDefaultResourceTypeTable() {
    IPreferenceStore store = doGetPreferenceStore();
    String editors = store.getDefaultString(doGetPreferenceID());
    fillResourceTypeTable(editors);
}

From source file:com.aptana.ide.editors.preferences.ProblemsPreferencePage.java

License:Open Source License

/**
 * Performs special processing when this page's Defaults button has been pressed.
 * <p>/*w  ww.java2s .  co  m*/
 * This is a framework hook method for subclasses to do special things when the Defaults button has been pressed.
 * Subclasses may override, but should call <code>super.performDefaults</code>.
 * </p>
 */
protected void performDefaults() {
    super.performDefaults();

    IPreferenceStore store = doGetPreferenceStore();
    String editors = store.getDefaultString(doGetPreferenceString());
    ErrorDescriptor[] descriptors = ErrorDescriptor.deserializeErrorDescriptors(editors);
    List<Object> items = new ArrayList<Object>(Arrays.asList(descriptors));
    _tableEditor.setItems(items);

    String stored_validators = this.getPreferenceStore().getDefaultString(IPreferenceConstants.VALIDATORS_LIST);
    restoreCheckedValidators(stored_validators);
}

From source file:com.aptana.ide.intro.IntroStartup.java

License:Open Source License

private void showStartupPage() {
    UIJob job = new UIJob("Showing Startup Page") { //$NON-NLS-1$

        public IStatus runInUIThread(IProgressMonitor monitor) {
            IWorkbenchPart activePart = null;
            IWorkbenchPage page = null;//from   ww w. j a v a 2 s  .  c  om
            IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (window != null) {
                page = window.getActivePage();
                activePart = page.getActivePart();
            }
            IPreferenceStore prefs = IntroPlugin.getDefault().getPreferenceStore();
            String editorId = prefs.getString(IPreferenceConstants.INTRO_EDITOR_ID);
            IEditorPart editorPart = CoreUIUtils.openEditor(editorId, false);
            if (editorPart == null) {
                // falls back to the default
                editorId = prefs.getDefaultString(IPreferenceConstants.INTRO_EDITOR_ID);
                prefs.setValue(IPreferenceConstants.INTRO_EDITOR_ID, editorId);
                CoreUIUtils.openEditor(editorId, false);
            }
            // makes the active part re-grab the focus
            if (activePart != null) {
                page.activate(activePart);
            }
            return Status.OK_STATUS;
        }

    };
    job.schedule(1000);
}

From source file:com.aptana.ide.logging.LoggingPreferences.java

License:Open Source License

/**
 * @return//  w  ww.  j  a va2 s .  co  m
 */
public String getDefaultDefaultEncoding() {
    IPreferenceStore store = getPreferenceStore();
    return store.getDefaultString(DEFAULT_ENCODING_KEY);
}