use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class AbstractNodeCleanupHandler method getCleanupPreferences.
public IStructuredCleanupPreferences getCleanupPreferences() {
if (fCleanupPreferences == null) {
fCleanupPreferences = new StructuredCleanupPreferences();
Preferences preferences = getModelPreferences();
if (preferences != null) {
fCleanupPreferences.setTagNameCase(preferences.getInt(HTMLCorePreferenceNames.CLEANUP_TAG_NAME_CASE));
fCleanupPreferences.setAttrNameCase(preferences.getInt(HTMLCorePreferenceNames.CLEANUP_ATTR_NAME_CASE));
fCleanupPreferences.setCompressEmptyElementTags(preferences.getBoolean(HTMLCorePreferenceNames.COMPRESS_EMPTY_ELEMENT_TAGS));
fCleanupPreferences.setInsertRequiredAttrs(preferences.getBoolean(HTMLCorePreferenceNames.INSERT_REQUIRED_ATTRS));
fCleanupPreferences.setInsertMissingTags(preferences.getBoolean(HTMLCorePreferenceNames.INSERT_MISSING_TAGS));
fCleanupPreferences.setQuoteAttrValues(preferences.getBoolean(HTMLCorePreferenceNames.QUOTE_ATTR_VALUES));
fCleanupPreferences.setFormatSource(preferences.getBoolean(HTMLCorePreferenceNames.FORMAT_SOURCE));
fCleanupPreferences.setConvertEOLCodes(preferences.getBoolean(HTMLCorePreferenceNames.CONVERT_EOL_CODES));
fCleanupPreferences.setEOLCode(preferences.getString(HTMLCorePreferenceNames.CLEANUP_EOL_CODE));
}
}
return fCleanupPreferences;
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class JSONCleanupStrategyImpl method initialize.
/**
*/
private void initialize() {
Preferences prefs = JSONCorePlugin.getDefault().getPluginPreferences();
// fIdentCase = getCleanupCaseValue(prefs
// .getInt(JSONCorePreferenceNames.CLEANUP_CASE_IDENTIFIER));
// fPropNameCase = getCleanupCaseValue(prefs
// .getInt(JSONCorePreferenceNames.CLEANUP_CASE_PROPERTY_NAME));
// fPropValueCase = getCleanupCaseValue(prefs
// .getInt(JSONCorePreferenceNames.CLEANUP_CASE_PROPERTY_VALUE));
// fSelectorTagCase = getCleanupCaseValue(prefs
// .getInt(JSONCorePreferenceNames.CLEANUP_CASE_SELECTOR));
// fIdCase = getCleanupCaseValue(prefs
// .getInt(JSONCorePreferenceNames.CLEANUP_CASE_ID_SELECTOR));
// fClassCase = getCleanupCaseValue(prefs
// .getInt(JSONCorePreferenceNames.CLEANUP_CASE_CLASS_SELECTOR));
fQuoteValues = prefs.getBoolean(JSONCorePreferenceNames.QUOTE_ATTR_VALUES);
fFormatSource = prefs.getBoolean(JSONCorePreferenceNames.FORMAT_SOURCE);
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class StructuredTextViewerConfigurationHTML method getIndentPrefixes.
public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
Vector vector = new Vector();
// prefix[0] is either '\t' or ' ' x tabWidth, depending on preference
Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
int indentationWidth = preferences.getInt(HTMLCorePreferenceNames.INDENTATION_SIZE);
String indentCharPref = preferences.getString(HTMLCorePreferenceNames.INDENTATION_CHAR);
boolean useSpaces = HTMLCorePreferenceNames.SPACE.equals(indentCharPref);
for (int i = 0; i <= indentationWidth; i++) {
StringBuffer prefix = new StringBuffer();
boolean appendTab = false;
if (useSpaces) {
for (int j = 0; j + i < indentationWidth; j++) prefix.append(' ');
if (i != 0)
appendTab = true;
} else {
for (int j = 0; j < i; j++) prefix.append(' ');
if (i != indentationWidth)
appendTab = true;
}
if (appendTab) {
prefix.append('\t');
vector.add(prefix.toString());
// remove the tab so that indentation - tab is also an indent
// prefix
prefix.deleteCharAt(prefix.length() - 1);
}
vector.add(prefix.toString());
}
// $NON-NLS-1$
vector.add("");
return (String[]) vector.toArray(new String[vector.size()]);
}
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 HTMLNodeActionManager method updateCase.
/**
* Another HTML specific detail.
*/
protected void updateCase() {
if (fModel != null) {
String modelContentTypeId = fModel.getContentTypeIdentifier();
if (modelContentTypeId != null) {
if (modelContentTypeId.equals(ContentTypeIdForHTML.ContentTypeID_HTML)) {
// $NON-NLS-1$
Preferences prefs = HTMLCorePlugin.getDefault().getPluginPreferences();
fTagCase = prefs.getInt(HTMLCorePreferenceNames.TAG_NAME_CASE);
fAttrCase = prefs.getInt(HTMLCorePreferenceNames.ATTR_NAME_CASE);
}
}
}
}
Aggregations