Search in sources :

Example 66 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 67 with Preferences

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

the class NewHTMLFileWizardPage method addDefaultExtension.

/**
 * Adds default extension to the filename
 *
 * @param filename
 * @return
 */
String addDefaultExtension(String filename) {
    StringBuffer newFileName = new StringBuffer(filename);
    Preferences preference = HTMLCorePlugin.getDefault().getPluginPreferences();
    String ext = preference.getString(HTMLCorePreferenceNames.DEFAULT_EXTENSION);
    // $NON-NLS-1$
    newFileName.append(".");
    newFileName.append(ext);
    return newFileName.toString();
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Example 68 with Preferences

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

the class CSSSourcePreferencePage method storeValuesForFormattingGroup.

private void storeValuesForFormattingGroup() {
    // Formatting
    Preferences prefs = getModelPreferences();
    prefs.setValue(CSSCorePreferenceNames.LINE_WIDTH, fLineWidthText.getText());
    prefs.setValue(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE, fPropertyPerLine.getSelection());
    prefs.setValue(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR, fNowrapAttr.getSelection());
    prefs.setValue(CSSCorePreferenceNames.FORMAT_SPACE_BETWEEN_SELECTORS, spaceBetweenSelectors.getSelection());
    if (fIndentUsingTabs.getSelection()) {
        getModelPreferences().setValue(CSSCorePreferenceNames.INDENTATION_CHAR, CSSCorePreferenceNames.TAB);
    } else {
        getModelPreferences().setValue(CSSCorePreferenceNames.INDENTATION_CHAR, CSSCorePreferenceNames.SPACE);
    }
    getModelPreferences().setValue(CSSCorePreferenceNames.INDENTATION_SIZE, fIndentationSize.getSelection());
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Example 69 with Preferences

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

the class CSSSourcePreferencePage method storeValuesForContentAssistGroup.

private void storeValuesForContentAssistGroup() {
    // not content assist, but preferred case
    Preferences prefs = getModelPreferences();
    prefs.setValue(CSSCorePreferenceNames.CASE_IDENTIFIER, (fIdentUpper.getSelection()) ? CSSCorePreferenceNames.UPPER : CSSCorePreferenceNames.LOWER);
    prefs.setValue(CSSCorePreferenceNames.CASE_SELECTOR, (fSelectorUpper.getSelection()) ? CSSCorePreferenceNames.UPPER : CSSCorePreferenceNames.LOWER);
    prefs.setValue(CSSCorePreferenceNames.CASE_PROPERTY_NAME, (fPropNameUpper.getSelection()) ? CSSCorePreferenceNames.UPPER : CSSCorePreferenceNames.LOWER);
    prefs.setValue(CSSCorePreferenceNames.CASE_PROPERTY_VALUE, (fPropValueUpper.getSelection()) ? CSSCorePreferenceNames.UPPER : CSSCorePreferenceNames.LOWER);
}
Also used : Preferences(org.eclipse.core.runtime.Preferences)

Example 70 with Preferences

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

the class CSSSourcePreferencePage method initializeValuesForContentAssistGroup.

private void initializeValuesForContentAssistGroup() {
    // not content assist, but preferred case
    Preferences prefs = getModelPreferences();
    fIdentUpper.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.UPPER);
    fIdentLower.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.LOWER);
    fSelectorUpper.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.UPPER);
    fSelectorLower.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.LOWER);
    fPropNameUpper.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.UPPER);
    fPropNameLower.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.LOWER);
    fPropValueUpper.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.UPPER);
    fPropValueLower.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.LOWER);
}
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