use of org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences in project webtools.sourceediting by eclipse.
the class FormatTester method testFormatEmpty.
public void testFormatEmpty() {
// get model
IStructuredModel structuredModel = getModel("empty.xml");
// init FormatPreferences
IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences();
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false);
formatPreferences.setLineWidth(999);
formatPreferences.setIndent("\t");
formatPreferences.setClearAllBlankLines(false);
// format
((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false;
fFormatProcessor.formatModel(structuredModel);
((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true;
// compare
String formatted = structuredModel.getStructuredDocument().get();
String expectedFileName = "empty.xml";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, formatted);
// release model
structuredModel.releaseFromRead();
}
use of org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences in project webtools.sourceediting by eclipse.
the class FormatTester method testFormatChars.
public void testFormatChars() {
// get model
IStructuredModel structuredModel = getModel("chars.xml");
// init FormatPreferences
IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences();
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false);
formatPreferences.setLineWidth(999);
formatPreferences.setIndent("\t");
formatPreferences.setClearAllBlankLines(false);
// format
((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false;
fFormatProcessor.formatModel(structuredModel);
((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true;
// compare
String formatted = structuredModel.getStructuredDocument().get();
String expectedFileName = "chars.xml";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, formatted);
// release model
structuredModel.releaseFromRead();
}
use of org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences in project webtools.sourceediting by eclipse.
the class FormatTester method testHTMLFormat.
public void testHTMLFormat() {
// get model
IStructuredModel structuredModel = getModel("HitCounterIntro.html");
// init FormatPreferences
IStructuredFormatPreferences formatPreferences = fHTMLFormatProcessor.getFormatPreferences();
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false);
formatPreferences.setLineWidth(72);
formatPreferences.setIndent("\t");
formatPreferences.setClearAllBlankLines(false);
// format
((AbstractStructuredFormatProcessor) fHTMLFormatProcessor).refreshFormatPreferences = false;
fHTMLFormatProcessor.formatModel(structuredModel);
((AbstractStructuredFormatProcessor) fHTMLFormatProcessor).refreshFormatPreferences = true;
// compare
String formatted = structuredModel.getStructuredDocument().get();
String expectedFileName = "HitCounterIntro.afterDefaultFormat.html";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, formatted);
// release model
structuredModel.releaseFromRead();
}
use of org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences in project webtools.sourceediting by eclipse.
the class FormatTester method testFormatSpacesAndChars.
public void testFormatSpacesAndChars() {
// get model
IStructuredModel structuredModel = getModel("spacesAndChars.xml");
// init FormatPreferences
IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences();
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false);
formatPreferences.setLineWidth(999);
formatPreferences.setIndent("\t");
formatPreferences.setClearAllBlankLines(false);
// format
((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false;
fFormatProcessor.formatModel(structuredModel);
((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true;
// compare
String formatted = structuredModel.getStructuredDocument().get();
String expectedFileName = "chars.xml";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, formatted);
// release model
structuredModel.releaseFromRead();
}
use of org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences in project webtools.sourceediting by eclipse.
the class FormatTester method testFormatBlockComments.
public void testFormatBlockComments() {
// get model
IStructuredModel structuredModel = getModel("blockComments.xml");
// init FormatPreferences
IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences();
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false);
formatPreferences.setLineWidth(999);
formatPreferences.setIndent("\t");
formatPreferences.setClearAllBlankLines(false);
// format
((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = false;
fFormatProcessor.formatModel(structuredModel);
((AbstractStructuredFormatProcessor) fFormatProcessor).refreshFormatPreferences = true;
// compare
String formatted = structuredModel.getStructuredDocument().get();
String expectedFileName = "blockComments.afterDefaultFormat.xml";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, formatted);
// release model
structuredModel.releaseFromRead();
}
Aggregations