}
public IStructuredFormatter createFormatter(Node node,
IStructuredFormatPreferences formatPreferences)
{
IStructuredFormatter formatter = null;
switch (node.getNodeType()) {
case Node.ELEMENT_NODE :
if (node instanceof ElementImplForTwig
&& ((ElementImplForTwig) node).isTwigTag()) {
formatter = new TwigFormatter(start, length);
} else {
formatter = new HtmlElementFormatterNoTwig();
}
break;
case Node.TEXT_NODE :
if (isEmbeddedCSS(node)) {
formatter = new EmbeddedCSSFormatterNoTwig();
} else {
formatter = new HTMLTextFormatterNoTwig();
}
break;
default :
formatter = new HTMLFormatterNoTwig();
break;
}
// init FormatPreferences
formatter.setFormatPreferences(formatPreferences);
return formatter;
}