use of org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences in project webtools.sourceediting by eclipse.
the class CleanupTester method testCleanupCompressEmptyElementTags.
public void testCleanupCompressEmptyElementTags() throws UnsupportedEncodingException, IOException {
// get model
IStructuredModel structuredModel = getModel("small2.xml");
// init CleanupPreferences
IStructuredCleanupPreferences cleanupPreferences = fCleanupProcessor.getCleanupPreferences();
cleanupPreferences.setCompressEmptyElementTags(true);
cleanupPreferences.setInsertRequiredAttrs(false);
cleanupPreferences.setInsertMissingTags(false);
cleanupPreferences.setQuoteAttrValues(false);
cleanupPreferences.setFormatSource(true);
cleanupPreferences.setConvertEOLCodes(false);
// cleanup
((AbstractStructuredCleanupProcessor) fCleanupProcessor).refreshCleanupPreferences = false;
fCleanupProcessor.cleanupModel(structuredModel);
((AbstractStructuredCleanupProcessor) fCleanupProcessor).refreshCleanupPreferences = true;
// compare
String cleaned = structuredModel.getStructuredDocument().get();
String expectedFileName = "small2.afterCompressEmptyElementTags-newfmt.xml";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, cleaned);
// release model
structuredModel.releaseFromRead();
}
use of org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences in project webtools.sourceediting by eclipse.
the class CleanupTester method testCleanupJSPEmptyTags2.
public void testCleanupJSPEmptyTags2() throws UnsupportedEncodingException, IOException {
// get model
IStructuredModel structuredModel = getModel("subscription.jsp");
// init CleanupPreferences
IStructuredCleanupPreferences cleanupPreferences = fHTMLCleanupProcessor.getCleanupPreferences();
cleanupPreferences.setTagNameCase(CommonModelPreferenceNames.UPPER);
cleanupPreferences.setAttrNameCase(CommonModelPreferenceNames.LOWER);
cleanupPreferences.setCompressEmptyElementTags(false);
cleanupPreferences.setInsertRequiredAttrs(false);
cleanupPreferences.setInsertMissingTags(true);
cleanupPreferences.setQuoteAttrValues(true);
cleanupPreferences.setFormatSource(true);
cleanupPreferences.setConvertEOLCodes(false);
// cleanup
((AbstractStructuredCleanupProcessor) fHTMLCleanupProcessor).refreshCleanupPreferences = false;
fHTMLCleanupProcessor.cleanupModel(structuredModel);
((AbstractStructuredCleanupProcessor) fHTMLCleanupProcessor).refreshCleanupPreferences = true;
// compare
String cleaned = structuredModel.getStructuredDocument().get();
String expectedFileName = "subscription.afterCleanup.jsp";
String expected = getFile(expectedFileName);
compare(expectedFileName, expected, cleaned);
// release model
structuredModel.releaseFromRead();
}
Aggregations