use of org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML 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();
}
use of org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML in project webtools.sourceediting by eclipse.
the class TestFormatProcessorXML method testSplitAttributesFormat.
public void testSplitAttributesFormat() throws UnsupportedEncodingException, IOException, CoreException {
// BUG113584
IStructuredFormatPreferences formatPreferences = formatProcessor.getFormatPreferences();
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(true);
((StructuredFormatPreferencesXML) formatPreferences).setAlignEndBracket(false);
formatAndAssertEquals("testfiles/xml/multiattributes.xml", "testfiles/xml/multiattributes-yessplit-noalign-fmt.xml", false);
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false);
((StructuredFormatPreferencesXML) formatPreferences).setAlignEndBracket(false);
formatAndAssertEquals("testfiles/xml/multiattributes.xml", "testfiles/xml/multiattributes-nosplit-noalign-fmt.xml", false);
}
use of org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML in project webtools.sourceediting by eclipse.
the class TestFormatProcessorXML method testEmptyContentNodeFormat.
public void testEmptyContentNodeFormat() throws UnsupportedEncodingException, IOException, CoreException {
// BUG174243
IStructuredFormatPreferences formatPreferences = formatProcessor.getFormatPreferences();
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(true);
formatAndAssertEquals("testfiles/xml/usetagswithemptycontent.xml", "testfiles/xml/usetagswithemptycontent-fmt.xml", false);
}
use of org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML in project webtools.sourceediting by eclipse.
the class TestFormatProcessorHTML method resetPreferencesToDefault.
private void resetPreferencesToDefault() {
IStructuredFormatPreferences formatPreferences = formatProcessor.getFormatPreferences();
formatPreferences.setLineWidth(MAX_LINE_WIDTH);
formatPreferences.setClearAllBlankLines(CLEAR_ALL_BLANK_LINES);
formatPreferences.setIndent(INDENT);
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(SPLIT_MULTI_ATTRS);
}
use of org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML in project webtools.sourceediting by eclipse.
the class FormatTester method testFormatSplitLines.
public void testFormatSplitLines() {
// get model
IStructuredModel structuredModel = getModel("small.xml");
// init FormatPreferences
IStructuredFormatPreferences formatPreferences = fFormatProcessor.getFormatPreferences();
((StructuredFormatPreferencesXML) formatPreferences).setSplitMultiAttrs(false);
formatPreferences.setLineWidth(72);
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.afterSplitLinesFormat.xml";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, formatted);
// release model
structuredModel.releaseFromRead();
}
Aggregations