Search in sources :

Example 11 with IStructuredCleanupPreferences

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();
}
Also used : IStructuredCleanupPreferences(org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)

Example 12 with IStructuredCleanupPreferences

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();
}
Also used : IStructuredCleanupPreferences(org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences) IStructuredModel(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)

Aggregations

IStructuredCleanupPreferences (org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupPreferences)12 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)7 Preferences (org.eclipse.core.runtime.Preferences)4 StructuredCleanupPreferences (org.eclipse.wst.sse.core.internal.cleanup.StructuredCleanupPreferences)4 HTMLCleanupProcessorImpl (org.eclipse.wst.html.core.internal.cleanup.HTMLCleanupProcessorImpl)1