Search in sources :

Example 41 with Preferences

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

the class TestFormatProcessorCSS method setUp.

protected void setUp() throws Exception {
    // set up preferences
    Preferences prefs = CSSCorePlugin.getDefault().getPluginPreferences();
    fOldClearBlankLinesPref = prefs.getBoolean(CSSCorePreferenceNames.CLEAR_ALL_BLANK_LINES);
    fOldMaxLineWidthPref = prefs.getInt(CSSCorePreferenceNames.LINE_WIDTH);
    fOldIndentationCharPref = prefs.getString(CSSCorePreferenceNames.INDENTATION_CHAR);
    fOldIndentationSizePref = prefs.getInt(CSSCorePreferenceNames.INDENTATION_SIZE);
    prefs.setValue(CSSCorePreferenceNames.CLEAR_ALL_BLANK_LINES, false);
    prefs.setValue(CSSCorePreferenceNames.LINE_WIDTH, 72);
    prefs.setValue(CSSCorePreferenceNames.INDENTATION_CHAR, CSSCorePreferenceNames.TAB);
    prefs.setValue(CSSCorePreferenceNames.INDENTATION_SIZE, 1);
    formatProcessor = new FormatProcessorCSS();
    fStringCompareUtil = new StringCompareUtil();
}
Also used : StringCompareUtil(org.eclipse.wst.css.core.tests.util.StringCompareUtil) FormatProcessorCSS(org.eclipse.wst.css.core.internal.format.FormatProcessorCSS) Preferences(org.eclipse.core.runtime.Preferences)

Example 42 with Preferences

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

the class HTMLFormatProcessorImpl method getFormatPreferences.

public IStructuredFormatPreferences getFormatPreferences() {
    if (fFormatPreferences == null) {
        fFormatPreferences = new StructuredFormatPreferencesXML();
        Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
        if (preferences != null) {
            fFormatPreferences.setLineWidth(preferences.getInt(HTMLCorePreferenceNames.LINE_WIDTH));
            ((StructuredFormatPreferencesXML) fFormatPreferences).setSplitMultiAttrs(preferences.getBoolean(HTMLCorePreferenceNames.SPLIT_MULTI_ATTRS));
            ((StructuredFormatPreferencesXML) fFormatPreferences).setAlignEndBracket(preferences.getBoolean(HTMLCorePreferenceNames.ALIGN_END_BRACKET));
            fFormatPreferences.setClearAllBlankLines(preferences.getBoolean(HTMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES));
            char indentChar = ' ';
            String indentCharPref = preferences.getString(HTMLCorePreferenceNames.INDENTATION_CHAR);
            if (HTMLCorePreferenceNames.TAB.equals(indentCharPref)) {
                indentChar = '\t';
            }
            int indentationWidth = preferences.getInt(HTMLCorePreferenceNames.INDENTATION_SIZE);
            StringBuffer indent = new StringBuffer();
            for (int i = 0; i < indentationWidth; i++) {
                indent.append(indentChar);
            }
            fFormatPreferences.setIndent(indent.toString());
        }
    }
    return fFormatPreferences;
}
Also used : StructuredFormatPreferencesXML(org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML) IStructuredFormatPreferences(org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences) Preferences(org.eclipse.core.runtime.Preferences)

Example 43 with Preferences

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

the class HTMLFormatterFactory method getFormatPreferences.

protected StructuredFormatPreferencesXML getFormatPreferences() {
    if (fFormatPreferences == null) {
        fFormatPreferences = new StructuredFormatPreferencesXML();
        Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
        if (preferences != null) {
            fFormatPreferences.setLineWidth(preferences.getInt(HTMLCorePreferenceNames.LINE_WIDTH));
            fFormatPreferences.setSplitMultiAttrs(preferences.getBoolean(HTMLCorePreferenceNames.SPLIT_MULTI_ATTRS));
            fFormatPreferences.setAlignEndBracket(preferences.getBoolean(HTMLCorePreferenceNames.ALIGN_END_BRACKET));
            fFormatPreferences.setClearAllBlankLines(preferences.getBoolean(HTMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES));
            char indentChar = ' ';
            String indentCharPref = preferences.getString(HTMLCorePreferenceNames.INDENTATION_CHAR);
            if (HTMLCorePreferenceNames.TAB.equals(indentCharPref)) {
                indentChar = '\t';
            }
            int indentationWidth = preferences.getInt(HTMLCorePreferenceNames.INDENTATION_SIZE);
            StringBuffer indent = new StringBuffer();
            for (int i = 0; i < indentationWidth; i++) {
                indent.append(indentChar);
            }
            fFormatPreferences.setIndent(indent.toString());
        }
    }
    return fFormatPreferences;
}
Also used : StructuredFormatPreferencesXML(org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML) IStructuredFormatPreferences(org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences) Preferences(org.eclipse.core.runtime.Preferences)

Example 44 with Preferences

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

the class CSSCleanupStrategyImpl method initialize.

/**
 */
private void initialize() {
    Preferences prefs = CSSCorePlugin.getDefault().getPluginPreferences();
    fIdentCase = getCleanupCaseValue(prefs.getInt(CSSCorePreferenceNames.CLEANUP_CASE_IDENTIFIER));
    fPropNameCase = getCleanupCaseValue(prefs.getInt(CSSCorePreferenceNames.CLEANUP_CASE_PROPERTY_NAME));
    fPropValueCase = getCleanupCaseValue(prefs.getInt(CSSCorePreferenceNames.CLEANUP_CASE_PROPERTY_VALUE));
    fSelectorTagCase = getCleanupCaseValue(prefs.getInt(CSSCorePreferenceNames.CLEANUP_CASE_SELECTOR));
    fIdCase = getCleanupCaseValue(prefs.getInt(CSSCorePreferenceNames.CLEANUP_CASE_ID_SELECTOR));
    fClassCase = getCleanupCaseValue(prefs.getInt(CSSCorePreferenceNames.CLEANUP_CASE_CLASS_SELECTOR));
    fQuoteValues = prefs.getBoolean(CSSCorePreferenceNames.QUOTE_ATTR_VALUES);
    fFormatSource = prefs.getBoolean(CSSCorePreferenceNames.FORMAT_SOURCE);
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Example 45 with Preferences

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

the class NewJSPFileWizardPage method addDefaultExtension.

/**
 * Adds default extension to the filename
 *
 * @param filename
 * @return
 */
String addDefaultExtension(String filename) {
    StringBuffer newFileName = new StringBuffer(filename);
    Preferences preference = JSPCorePlugin.getDefault().getPluginPreferences();
    String ext = preference.getString(JSPCorePreferenceNames.DEFAULT_EXTENSION);
    // $NON-NLS-1$
    newFileName.append(".");
    newFileName.append(ext);
    return newFileName.toString();
}
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