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