use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class CSSSourcePreferencePage method initializeValuesForFormattingGroup.
private void initializeValuesForFormattingGroup() {
// Formatting
Preferences prefs = getModelPreferences();
fLineWidthText.setText(prefs.getString(CSSCorePreferenceNames.LINE_WIDTH));
fPropertyPerLine.setSelection(prefs.getBoolean(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE));
fNowrapAttr.setSelection(prefs.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR));
spaceBetweenSelectors.setSelection(prefs.getBoolean(CSSCorePreferenceNames.FORMAT_SPACE_BETWEEN_SELECTORS));
if (CSSCorePreferenceNames.TAB.equals(getModelPreferences().getString(CSSCorePreferenceNames.INDENTATION_CHAR))) {
fIndentUsingTabs.setSelection(true);
fIndentUsingSpaces.setSelection(false);
} else {
fIndentUsingSpaces.setSelection(true);
fIndentUsingTabs.setSelection(false);
}
fIndentationSize.setSelection(getModelPreferences().getInt(CSSCorePreferenceNames.INDENTATION_SIZE));
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class CSSProposalGenerator method getIndentString.
private String getIndentString() {
StringBuffer indent = new StringBuffer();
Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
if (preferences != null) {
char indentChar = ' ';
String indentCharPref = preferences.getString(CSSCorePreferenceNames.INDENTATION_CHAR);
if (CSSCorePreferenceNames.TAB.equals(indentCharPref)) {
indentChar = '\t';
}
int indentationWidth = preferences.getInt(CSSCorePreferenceNames.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 CSSProposalGeneratorForDeclarationName method getCandidates.
/**
* getCandidates method comment.
*/
protected Iterator getCandidates() {
List candidates = new ArrayList();
Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
// $NON-NLS-1$
String preDelim = "";
for (int i = 0; i < preferences.getInt(CSSCorePreferenceNames.FORMAT_PROP_PRE_DELIM); i++) {
// $NON-NLS-1$
preDelim += ' ';
}
// $NON-NLS-1$
String postDelim = "";
for (int i = 0; i < preferences.getInt(CSSCorePreferenceNames.FORMAT_PROP_POST_DELIM); i++) {
// $NON-NLS-1$
postDelim += ' ';
}
ICSSNode targetNode = fContext.getTargetNode();
boolean bFontRule = false;
for (ICSSNode node = targetNode; node != null; node = node.getParentNode()) {
if (node instanceof org.w3c.dom.css.CSSFontFaceRule) {
bFontRule = true;
break;
}
}
List names = new ArrayList();
CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
Iterator iNames = util.collectNodesByType((bFontRule) ? CSSMMNode.TYPE_DESCRIPTOR : CSSMMNode.TYPE_PROPERTY);
while (iNames.hasNext()) {
CSSMMNode node = (CSSMMNode) iNames.next();
names.add(node);
}
sortNames(names);
// Collections.sort(names);
boolean bAddColon = true;
if ((targetNode instanceof ICSSStyleRule || targetNode instanceof ICSSStyleDeclItem || targetNode instanceof ICSSStyleDeclaration) && fContext.targetHas(CSSRegionContexts.CSS_DECLARATION_SEPARATOR)) {
bAddColon = false;
}
Iterator i = names.iterator();
while (i.hasNext()) {
CSSMMNode node = (CSSMMNode) i.next();
String text = node.getName();
text = (preferences.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.UPPER) ? text.toUpperCase() : text.toLowerCase();
if (!isMatch(text)) {
continue;
}
int cursorPos = 0;
StringBuffer buf = new StringBuffer();
buf.append(text);
buf.append(preDelim);
cursorPos = buf.length();
if (bAddColon) {
// $NON-NLS-1$
buf.append(':');
buf.append(postDelim);
cursorPos += 1 + postDelim.length();
}
// if (! (targetNode instanceof ICSSStyleDeclItem)) {
// buf.append(';');//$NON-NLS-1$
// }
CSSCACandidate item = new CSSCACandidate();
item.setReplacementString(buf.toString());
item.setCursorPosition(cursorPos);
item.setDisplayString(text);
item.setMMNode(node);
item.setImageType(getCategoryImageType(node));
candidates.add(item);
}
return candidates.iterator();
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class TestJSPContentFormatter method resetPreferencesToDefault.
private void resetPreferencesToDefault() {
Preferences preferences = HTMLCorePlugin.getDefault().getPluginPreferences();
preferences.setToDefault(HTMLCorePreferenceNames.SPLIT_MULTI_ATTRS);
preferences.setToDefault(HTMLCorePreferenceNames.LINE_WIDTH);
preferences.setToDefault(HTMLCorePreferenceNames.INDENTATION_CHAR);
preferences.setToDefault(HTMLCorePreferenceNames.INDENTATION_SIZE);
preferences.setToDefault(HTMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES);
}
use of org.eclipse.core.runtime.Preferences in project webtools.sourceediting by eclipse.
the class SSECorePlugin method initializeDefaultPluginPreferences.
/**
* Set default non-UI
*/
protected void initializeDefaultPluginPreferences() {
Preferences prefs = getDefault().getPluginPreferences();
// set model preference defaults
prefs.setDefault(CommonEncodingPreferenceNames.USE_3BYTE_BOM_WITH_UTF8, false);
prefs.setDefault(CommonModelPreferenceNames.TASK_TAG_ENABLE, false);
// $NON-NLS-1$
prefs.setDefault(CommonModelPreferenceNames.TASK_TAG_TAGS, "TODO,FIXME,XXX");
// $NON-NLS-1$
prefs.setDefault(CommonModelPreferenceNames.TASK_TAG_PRIORITIES, "1,2,1");
}
Aggregations