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);
}
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();
}
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();
}
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;
}
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);
}
Aggregations