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; } }
public IStructuredFormatPreferences getFormatPreferences() { if (fFormatPreferences == null) { fFormatPreferences = new StructuredFormatPreferencesXML(); Preferences preferences = getModelPreferences(); if (preferences != null) { fFormatPreferences.setLineWidth(preferences.getInt(XMLCorePreferenceNames.LINE_WIDTH)); ((StructuredFormatPreferencesXML) fFormatPreferences).setSplitMultiAttrs(preferences.getBoolean(XMLCorePreferenceNames.SPLIT_MULTI_ATTRS)); ((StructuredFormatPreferencesXML) fFormatPreferences).setAlignEndBracket(preferences.getBoolean(XMLCorePreferenceNames.ALIGN_END_BRACKET)); ((StructuredFormatPreferencesXML) fFormatPreferences).setPreservePCDATAContent(preferences.getBoolean(XMLCorePreferenceNames.PRESERVE_CDATACONTENT)); fFormatPreferences.setClearAllBlankLines(preferences.getBoolean(XMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES)); 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); } fFormatPreferences.setIndent(indent.toString()); } } return fFormatPreferences; }
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; }
String singleIndent = preferences.getIndent(); String lineIndent = formatContraints.getCurrentIndent(); String attrIndent = lineIndent + singleIndent; boolean splitMultiAttrs = preferences.getSplitMultiAttrs(); boolean alignEndBracket = preferences.isAlignEndBracket(); boolean sawXmlSpace = false; String text = node.getStructuredDocument().get(lineOffset, nodeNameOffset - lineOffset); int usedWidth = getIndentationLength(text); currentAvailableLineWidth = preferences.getLineWidth() - usedWidth; stringBuffer.append(lineDelimiter + attrIndent); startTagSpansOver1Line = true; currentAvailableLineWidth = preferences.getLineWidth() - attrIndent.length(); stringBuffer.append(lineDelimiter + attrIndent); startTagSpansOver1Line = true; currentAvailableLineWidth = preferences.getLineWidth() - attrIndent.length(); if (elementDeclaration != null) { int contentType = elementDeclaration.getContentType(); if (preferences.isPreservePCDATAContent() && contentType == CMElementDeclaration.PCDATA) { formatContraints.setInPreserveSpaceElement(true);
insertBreak = ((StructuredFormatPreferencesXML) getFormatPreferences()).getSplitMultiAttrs(); boolean alignEndBracket = ((StructuredFormatPreferencesXML) getFormatPreferences()).isAlignEndBracket(); boolean attributesSplitted = false;
public IStructuredFormatPreferences getFormatPreferences() { if (fFormatPreferences == null) { fFormatPreferences = new StructuredFormatPreferencesXML(); Preferences preferences = getModelPreferences(); if (preferences != null) { fFormatPreferences.setLineWidth(preferences.getInt(XMLCorePreferenceNames.LINE_WIDTH)); ((StructuredFormatPreferencesXML) fFormatPreferences).setSplitMultiAttrs(preferences.getBoolean(XMLCorePreferenceNames.SPLIT_MULTI_ATTRS)); ((StructuredFormatPreferencesXML) fFormatPreferences).setAlignEndBracket(preferences.getBoolean(XMLCorePreferenceNames.ALIGN_END_BRACKET)); ((StructuredFormatPreferencesXML) fFormatPreferences).setPreservePCDATAContent(preferences.getBoolean(XMLCorePreferenceNames.PRESERVE_CDATACONTENT)); fFormatPreferences.setClearAllBlankLines(preferences.getBoolean(XMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES)); 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); } fFormatPreferences.setIndent(indent.toString()); } } return fFormatPreferences; }
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; } }