Search in sources :

Example 16 with IStructuredFormatPreferences

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

Example 17 with IStructuredFormatPreferences

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

Example 18 with IStructuredFormatPreferences

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

Example 19 with IStructuredFormatPreferences

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

Example 20 with IStructuredFormatPreferences

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

Aggregations

IStructuredFormatPreferences (org.eclipse.wst.sse.core.internal.format.IStructuredFormatPreferences)28 StructuredFormatPreferencesXML (org.eclipse.wst.xml.core.internal.provisional.format.StructuredFormatPreferencesXML)26 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)17 Preferences (org.eclipse.core.runtime.Preferences)4