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:org.emftext.language.xpath2.resource.xpath2.ui.Xpath2SyntaxColoringPreferencePage.java

License:Open Source License

private void restoreDefaultStringValue(IPreferenceStore preferenceStore, String key) {
    preferenceStore.setValue(key, preferenceStore.getDefaultString(key));
}

From source file:org.emftext.language.xpath3.resource.xpath3.ui.Xpath3BracketPreferencePage.java

License:Open Source License

/**
 * Sets the default values for this preference page.
 *///  w  w  w.j  a  v  a 2 s . c o m
protected void performDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    enableCheckbox.setSelection(preferenceStore.getDefaultBoolean(
            org.emftext.language.xpath3.resource.xpath3.ui.Xpath3PreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX));
    matchingBracketsColorButton.setEnabled(enableCheckbox.getSelection());
    matchingBracketsColorEditor
            .setColorValue(PreferenceConverter.getDefaultColor(preferenceStore, BRACKETS_COLOR));
    String defaultBrackets = preferenceStore.getDefaultString(language
            + org.emftext.language.xpath3.resource.xpath3.ui.Xpath3PreferenceConstants.EDITOR_BRACKETS_SUFFIX);
    bracketSetTemp.put(language, defaultBrackets);
    bracketsTmp.deserialize(bracketSetTemp.get(language));
    bracketsList.setItems(bracketsTmp.getBracketArray());
    // Reset check boxes and disable them because no item is selected in the
    // bracketsList component.
    enableClosingInside.setSelection(false);
    enableCloseAfterEnter.setSelection(false);
    enableClosingInside.setEnabled(false);
    enableCloseAfterEnter.setEnabled(false);
}

From source file:org.emftext.language.xpath3.resource.xpath3.ui.Xpath3ContentAssistPreferencePage.java

License:Open Source License

protected void performDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    assistEnabled = preferenceStore.getDefaultBoolean(
            org.emftext.language.xpath3.resource.xpath3.ui.Xpath3PreferenceConstants.EDITOR_CONTENT_ASSIST_ENABLED);
    activationDelay = preferenceStore.getDefaultInt(
            org.emftext.language.xpath3.resource.xpath3.ui.Xpath3PreferenceConstants.EDITOR_CONTENT_ASSIST_DELAY);
    activationTriggers = preferenceStore.getDefaultString(
            org.emftext.language.xpath3.resource.xpath3.ui.Xpath3PreferenceConstants.EDITOR_CONTENT_ASSIST_TRIGGERS);
    // defaults in widgets
    btnActivate.setEnabled(assistEnabled);
    btnActivate.setSelection(assistEnabled);
    txtDelay.setEnabled(assistEnabled);// w w  w  . ja va 2  s .c  om
    txtDelay.setText(String.valueOf(activationDelay));
    txtTriggers.setEnabled(assistEnabled);
    txtTriggers.setText(activationTriggers);
}

From source file:org.emftext.sdk.concretesyntax.resource.cs.ui.CsBracketPreferencePage.java

License:Open Source License

/**
 * Sets the default values for this preference page.
 *//*from  w ww .ja  va  2s  . c  o m*/
protected void performDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    enableCheckbox.setSelection(preferenceStore.getDefaultBoolean(
            org.emftext.sdk.concretesyntax.resource.cs.ui.CsPreferenceConstants.EDITOR_MATCHING_BRACKETS_CHECKBOX));
    matchingBracketsColorButton.setEnabled(enableCheckbox.getSelection());
    matchingBracketsColorEditor
            .setColorValue(PreferenceConverter.getDefaultColor(preferenceStore, BRACKETS_COLOR));
    String defaultBrackets = preferenceStore.getDefaultString(language
            + org.emftext.sdk.concretesyntax.resource.cs.ui.CsPreferenceConstants.EDITOR_BRACKETS_SUFFIX);
    bracketSetTemp.put(language, defaultBrackets);
    bracketsTmp.deserialize(bracketSetTemp.get(language));
    bracketsList.setItems(bracketsTmp.getBracketArray());
    // Reset check boxes and disable them because no item is selected in the
    // bracketsList component.
    enableClosingInside.setSelection(false);
    enableCloseAfterEnter.setSelection(false);
    enableClosingInside.setEnabled(false);
    enableCloseAfterEnter.setEnabled(false);
}

From source file:org.emftext.sdk.concretesyntax.resource.cs.ui.CsContentAssistPreferencePage.java

License:Open Source License

protected void performDefaults() {
    IPreferenceStore preferenceStore = getPreferenceStore();
    assistEnabled = preferenceStore.getDefaultBoolean(
            org.emftext.sdk.concretesyntax.resource.cs.ui.CsPreferenceConstants.EDITOR_CONTENT_ASSIST_ENABLED);
    activationDelay = preferenceStore.getDefaultInt(
            org.emftext.sdk.concretesyntax.resource.cs.ui.CsPreferenceConstants.EDITOR_CONTENT_ASSIST_DELAY);
    activationTriggers = preferenceStore.getDefaultString(
            org.emftext.sdk.concretesyntax.resource.cs.ui.CsPreferenceConstants.EDITOR_CONTENT_ASSIST_TRIGGERS);
    // defaults in widgets
    btnActivate.setEnabled(assistEnabled);
    btnActivate.setSelection(assistEnabled);
    txtDelay.setEnabled(assistEnabled);// w ww.  j a  v  a 2  s  .c  om
    txtDelay.setText(String.valueOf(activationDelay));
    txtTriggers.setEnabled(assistEnabled);
    txtTriggers.setText(activationTriggers);
}

From source file:org.erlide.ui.util.OverlayPreferenceStore.java

License:Open Source License

/**
 * Loads the given key from the orgin into the target.
 * //w ww .  ja v a2  s . c  o  m
 * @param orgin
 *            the source preference store
 * @param key
 *            the overlay key
 * @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(final IPreferenceStore orgin, final OverlayKey key, final IPreferenceStore target,
        final boolean forceInitialization) {
    final TypeDescriptor d = key.fDescriptor;
    if (TypeDescriptor.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 (TypeDescriptor.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 (TypeDescriptor.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 (TypeDescriptor.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 (TypeDescriptor.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 (TypeDescriptor.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:org.guvnor.tools.preferences.GuvnorPreferencePage.java

License:Apache License

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

    String defaultLoc = store.getDefaultString(IGuvnorPreferenceConstants.GUVNOR_LOC_TEMPLATE_PREF);
    if (defaultLoc == null || "".equals(defaultLoc)) {
        defaultLoc = IGuvnorPreferenceConstants.GUVNOR_LOC_TEMPLATE_DEFAULT;
    }/* ww w.j av  a 2  s.  c o  m*/
    store.putValue(IGuvnorPreferenceConstants.GUVNOR_LOC_TEMPLATE_PREF, defaultLoc);
    guvnorURLTemplate.setText(defaultLoc);

    store.putValue(IGuvnorPreferenceConstants.SAVE_PASSWORDS_PREF, String.valueOf(true));
    savePassword.setSelection(true);

    store.putValue(IGuvnorPreferenceConstants.OVERLAY_LOCATION_PREF,
            String.valueOf(IGuvnorPreferenceConstants.OVERLAY_LOCATION_DEFAULT));
    decorationIconLoc.select(IGuvnorPreferenceConstants.OVERLAY_LOCATION_DEFAULT);

    store.putValue(IGuvnorPreferenceConstants.SHOW_CHANGE_INDICATOR_PREF, String.valueOf(true));
    incChangeIndicator.setSelection(true);

    store.putValue(IGuvnorPreferenceConstants.SHOW_REVISION_PREF, String.valueOf(true));
    incRevision.setSelection(true);

    store.putValue(IGuvnorPreferenceConstants.SHOW_DATETIME_PREF, String.valueOf(true));
    incDateStamp.setSelection(true);

    PlatformUtils.updateDecoration();
    super.performDefaults();
}

From source file:org.isandlatech.plugins.rest.editor.outline.OutlineUtil.java

License:Open Source License

/**
 * Rewrites section and subsections titles blocks to use the preferred
 * marker for its level. Reads the preferred markers from the editor
 * preferences.//  ww w  .j a  v  a 2  s.c  om
 * 
 * It is recommended to have a least 6 preferred markers.
 * 
 * @param aSectionNode
 *            Base node to modify (its children will be modified to)
 */
public static void normalizeSectionsMarker(final TreeData aSectionNode) {

    if (aSectionNode == null) {
        return;
    }

    // Get preferred markers
    IPreferenceStore preferenceStore = RestPlugin.getDefault().getPreferenceStore();
    char[] preferredMarkersArray;

    // Try current preferences
    String preferredMarkers = preferenceStore.getString(IEditorPreferenceConstants.EDITOR_SECTION_MARKERS);

    if (preferredMarkers == null || preferredMarkers.isEmpty()) {
        // Else, try default preferences
        preferredMarkers = preferenceStore.getDefaultString(IEditorPreferenceConstants.EDITOR_SECTION_MARKERS);
    }

    if (preferredMarkers == null || preferredMarkers.isEmpty()) {
        // Else, use language definitions
        preferredMarkersArray = RestLanguage.SECTION_DECORATIONS;
    } else {

        preferredMarkersArray = preferredMarkers.toCharArray();
    }

    IDocument document = aSectionNode.getDocument();

    // Indicate that we will perform multiple replacements on the document
    DocumentRewriteSession rewriteSession = null;
    if (document instanceof IDocumentExtension4) {
        rewriteSession = ((IDocumentExtension4) document)
                .startRewriteSession(DocumentRewriteSessionType.SEQUENTIAL);
    }

    // Convert simple marker into section decorators objects
    SectionDecoration[] preferredDecoratorsArray = new SectionDecoration[preferredMarkersArray.length];

    int i = 0;
    for (char marker : preferredMarkersArray) {
        preferredDecoratorsArray[i++] = new SectionDecoration(marker, false);
    }

    normalizeSectionsMarker(aSectionNode, preferredDecoratorsArray);

    // Stop rewrite session
    if (rewriteSession != null) {
        ((IDocumentExtension4) document).stopRewriteSession(rewriteSession);
    }
}

From source file:org.jboss.jca.eclipse.command.IronJacamarDeployHelper.java

License:Open Source License

/**
 * Gets Preference string value by the preference name.
 * //w  w w .j av  a  2s .  c om
 * @param prefName the preference name
 * @return string value of the preference
 */
private String getPrefenceValue(String prefName) {
    IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
    String value = prefStore.getString(prefName);
    String deValue = prefStore.getDefaultString(prefName);
    if (value != null && value.length() > 0) {
        return value;
    }
    return deValue;
}

From source file:org.jboss.tools.common.el.ui.ca.ELProposalProcessor.java

License:Open Source License

public char[] getCompletionProposalAutoActivationCharacters() {
    if (autoActivChars == null) {
        IPreferenceStore store = EditorsUI.getPreferenceStore();
        String superDefaultChars = store
                .getDefaultString(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA);
        StringBuffer redhatDefaultChars = new StringBuffer(superDefaultChars);
        if (superDefaultChars.indexOf("{") < 0) { //$NON-NLS-1$
            redhatDefaultChars.append('{');
        }//from   w ww.  j  a va2 s . c o m
        if (superDefaultChars.indexOf(".") < 0) { //$NON-NLS-1$
            redhatDefaultChars.append('.');
        }
        if (superDefaultChars.indexOf("[") < 0) { //$NON-NLS-1$
            redhatDefaultChars.append('[');
        }

        autoActivChars = new char[redhatDefaultChars.length()];
        redhatDefaultChars.getChars(0, redhatDefaultChars.length(), autoActivChars, 0);
        store.setDefault(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA,
                redhatDefaultChars.toString());
        store.setValue(PreferenceConstants.CODEASSIST_AUTOACTIVATION_TRIGGERS_JAVA,
                redhatDefaultChars.toString());
    }
    return autoActivChars;
}