private String fMixedWhitespaceStrategy = XMLFormattingConstraints.IGNORE;
private String fOneIndent = "\t"; //$NON-NLS-1$
private boolean fClearAllBlankLines = false;
public XMLFormattingPreferences() {
Preferences preferences = XMLCorePlugin.getDefault().getPluginPreferences();
if (preferences != null) {
setFormatCommentText(preferences.getBoolean(XMLCorePreferenceNames.FORMAT_COMMENT_TEXT));
setJoinCommentLines(preferences.getBoolean(XMLCorePreferenceNames.FORMAT_COMMENT_JOIN_LINES));
setMaxLineWidth(preferences.getInt(XMLCorePreferenceNames.LINE_WIDTH));
setIndentMultipleAttributes(preferences.getBoolean(XMLCorePreferenceNames.SPLIT_MULTI_ATTRS));
setAlignFinalBracket(preferences.getBoolean(XMLCorePreferenceNames.ALIGN_END_BRACKET));
setSpaceBeforeEmptyCloseTag(preferences.getBoolean(XMLCorePreferenceNames.SPACE_BEFORE_EMPTY_CLOSE_TAG));
boolean preservepcdata = preferences.getBoolean(XMLCorePreferenceNames.PRESERVE_CDATACONTENT);
if (preservepcdata)
fPCDataWhitespaceStrategy = XMLFormattingPreferences.PRESERVE;
else
fPCDataWhitespaceStrategy = XMLFormattingPreferences.COLLAPSE;
char indentChar = ' ';
String indentCharPref = preferences.getString(XMLCorePreferenceNames.INDENTATION_CHAR);
if (XMLCorePreferenceNames.TAB.equals(indentCharPref)) {
indentChar = '\t';
}
int indentationWidth = preferences.getInt(XMLCorePreferenceNames.INDENTATION_SIZE);
StringBuffer indent = new StringBuffer();
for (int i = 0; i < indentationWidth; i++) {
indent.append(indentChar);
}
setOneIndent(indent.toString());
setClearAllBlankLines(preferences.getBoolean(XMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES));
}
}