public void run(){
try {
IDocument xmlDocument = getDocumentProvider().getDocument(getEditorInput());
String xmlString = xmlDocument.get();
FuzzyXMLDocument htmlModel = new FuzzyXMLParser(false, false).parse(xmlString);
FuzzyXMLElement documentElement = htmlModel.getDocumentElement();
IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
RenderContext renderContext = new RenderContext(true);
renderContext.setShowNewlines(true);
renderContext.setIndentSize(prefs.getInt(PreferenceConstants.INDENT_SIZE));
renderContext.setIndentTabs(prefs.getBoolean(PreferenceConstants.INDENT_TABS));
renderContext.setTrim(true);
renderContext.setLowercaseAttributes(prefs.getBoolean(PreferenceConstants.LOWERCASE_ATTRIBUTES));
renderContext.setLowercaseTags(prefs.getBoolean(PreferenceConstants.LOWERCASE_TAGS));
renderContext.setSpacesAroundEquals(prefs.getBoolean(PreferenceConstants.SPACES_AROUND_EQUALS));
renderContext.setSpaceInEmptyTags(true);
renderContext.setAddMissingQuotes(true);
renderContext.setDelegate(new WOHTMLRenderDelegate(prefs.getBoolean(PreferenceConstants.STICKY_WOTAGS)));
StringBuffer xmlBuffer = new StringBuffer();
FuzzyXMLDocType docType = htmlModel.getDocumentType();
if (docType != null) {
docType.toXMLString(renderContext, xmlBuffer);
}
for (FuzzyXMLNode node : documentElement.getChildren()) {
node.toXMLString(renderContext, xmlBuffer);
//htmlBuffer.append("\n");
}
xmlDocument.set(xmlBuffer.toString().trim());