Search in sources :

Example 36 with Preferences

use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.

the class CSSSourcePreferencePage method performDefaultsForContentAssistGroup.

private void performDefaultsForContentAssistGroup() {
    // not content assist, but preferred case
    Preferences prefs = getModelPreferences();
    fIdentUpper.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.UPPER);
    fIdentLower.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.LOWER);
    fSelectorUpper.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.UPPER);
    fSelectorLower.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.LOWER);
    fPropNameUpper.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.UPPER);
    fPropNameLower.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.LOWER);
    fPropValueUpper.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.UPPER);
    fPropValueLower.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.LOWER);
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Example 37 with Preferences

use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.

the class AbstractJSONSourceFormatter method decoratedIdentRegion.

protected String decoratedIdentRegion(CompoundRegion region, IJSONCleanupStrategy stgy) {
    if (isFormat())
        return region.getText();
    String text = null;
    if (!stgy.isFormatSource())
        text = region.getFullText();
    else
        text = region.getText();
    if (isCleanup()) {
        if (stgy.getIdentCase() == IJSONCleanupStrategy.ASIS)
            /*|| region.getType() == JSONRegionContexts.JSON_COMMENT*/
            return text;
        else if (stgy.getIdentCase() == IJSONCleanupStrategy.UPPER)
            return text.toUpperCase();
        else
            return text.toLowerCase();
    }
    Preferences preferences = JSONCorePlugin.getDefault().getPluginPreferences();
    // else
    return text.toLowerCase();
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Example 38 with Preferences

use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.

the class AbstractJSONSourceFormatter method getIndentString.

protected String getIndentString() {
    StringBuilder indent = new StringBuilder();
    Preferences preferences = JSONCorePlugin.getDefault().getPluginPreferences();
    if (preferences != null) {
        char indentChar = ' ';
        String indentCharPref = preferences.getString(JSONCorePreferenceNames.INDENTATION_CHAR);
        if (JSONCorePreferenceNames.TAB.equals(indentCharPref)) {
            indentChar = '\t';
        }
        int indentationWidth = preferences.getInt(JSONCorePreferenceNames.INDENTATION_SIZE);
        for (int i = 0; i < indentationWidth; i++) {
            indent.append(indentChar);
        }
    }
    return indent.toString();
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Example 39 with Preferences

use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.

the class AutoEditStrategyForTabs method getIndentationWidth.

/**
 * Returns indentation width if using spaces for indentation, -1 otherwise
 *
 * @return
 */
private int getIndentationWidth() {
    int width = -1;
    Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
    if (HTMLCorePreferenceNames.SPACE.equals(preferences.getString(HTMLCorePreferenceNames.INDENTATION_CHAR))) {
        width = preferences.getInt(HTMLCorePreferenceNames.INDENTATION_SIZE);
    }
    return width;
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Example 40 with Preferences

use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.

the class TestFormatProcessorCSS method tearDown.

protected void tearDown() throws Exception {
    // restore old preferences
    Preferences prefs = CSSCorePlugin.getDefault().getPluginPreferences();
    prefs.setValue(CSSCorePreferenceNames.CLEAR_ALL_BLANK_LINES, fOldClearBlankLinesPref);
    prefs.setValue(CSSCorePreferenceNames.LINE_WIDTH, fOldMaxLineWidthPref);
    prefs.setValue(CSSCorePreferenceNames.INDENTATION_CHAR, fOldIndentationCharPref);
    prefs.setValue(CSSCorePreferenceNames.INDENTATION_SIZE, fOldIndentationSizePref);
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Aggregations

Preferences (org.eclipse.core.runtime.Preferences)113 ByteArrayInputStream (java.io.ByteArrayInputStream)7 IndexedRegion (org.eclipse.wst.sse.core.internal.provisional.IndexedRegion)7 IFile (org.eclipse.core.resources.IFile)6 PartInitException (org.eclipse.ui.PartInitException)6 CSSCleanupStrategy (org.eclipse.wst.css.core.internal.cleanup.CSSCleanupStrategy)6 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 OutputStreamWriter (java.io.OutputStreamWriter)5 IStructuredFormatPreferences (org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences)5 ArrayList (java.util.ArrayList)4 CoreException (org.eclipse.core.runtime.CoreException)4 ICSSStyleDeclItem (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem)4 IStructuredCleanupPreferences (org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences)4 StructuredCleanupPreferences (org.eclipse.wst.sse.core.internal.cleanup.StructuredCleanupPreferences)4 List (java.util.List)3 Vector (java.util.Vector)3 ITextRegion (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion)3 ResultSet (java.sql.ResultSet)2 Statement (java.sql.Statement)2