use of org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences in project webtools.sourceediting by eclipse.
the class FormatTester method testFormat.
public void testFormat() {
// get model
IStructuredModel structuredModel = getModel("small.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 = "small.afterDefaultFormat.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 testFormatOneSpace.
public void testFormatOneSpace() {
// get model
IStructuredModel structuredModel = getModel("oneSpace.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 testFormat261968.
public void testFormat261968() {
// get model
IStructuredModel structuredModel = getModel("261968.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 = "261968.afterDefaultFormat.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 testFormatSpaces.
public void testFormatSpaces() {
// get model
IStructuredModel structuredModel = getModel("spaces.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 testFormatTagOpenTagClose.
public void testFormatTagOpenTagClose() {
// get model
IStructuredModel structuredModel = getModel("tagOpenTagClose.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 = "tagOpenTagClose.xml";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, formatted);
// release model
structuredModel.releaseFromRead();
}
Aggregations