protected IStructuredFormatProcessor getFormatProcessor() { return new FormatProcessorXML(); }
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) { final MultiPassContentFormatter formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), IXMLPartitions.XML_DEFAULT); formatter.setMasterStrategy(new StructuredFormattingStrategy(new FormatProcessorXML())); return formatter; }
/** * formats the node (and content). please make sure to only format the node you have created.. * * @param newNode */ public static void format(Node newNode) { Node parentNode = newNode.getParentNode(); if(parentNode != null && newNode.equals(parentNode.getLastChild())) { //add a new line to get the newly generated content correctly formatted. Document ownerDocument; if(parentNode instanceof Document) { ownerDocument = (Document) parentNode; } else { ownerDocument = parentNode.getOwnerDocument(); } parentNode.appendChild(ownerDocument.createTextNode("\n")); //$NON-NLS-1$ } FormatProcessorXML formatProcessor = new FormatProcessorXML(); //ignore any line width settings, causes wrong formatting of <foo>bar</foo> formatProcessor.getFormatPreferences().setLineWidth(2000); formatProcessor.formatNode(newNode); }
public void reformat(Node newElement, boolean deep) { try { // tell the model that we are about to make a big model change fModel.aboutToChangeModel(); // format selected node IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); formatProcessor.formatNode(newElement); } finally { // tell the model that we are done with the big model change fModel.changedModel(); } }
public static void formatChild(Node child) { if (child instanceof IDOMNode) { IDOMModel model = ((IDOMNode)child).getModel(); try { // tell the model that we are about to make a big model change model.aboutToChangeModel(); IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); formatProcessor.formatNode(child); } finally { // tell the model that we are done with the big model change model.changedModel(); } } }
protected void formatChild(Element child) { if (child instanceof IDOMNode) { IDOMModel model = ((IDOMNode)child).getModel(); try { // tell the model that we are about to make a big model change model.aboutToChangeModel(); IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); formatProcessor.formatNode(child); } finally { // tell the model that we are done with the big model change model.changedModel(); } } } /*
protected void formatChild(Element child) { if (child instanceof IDOMNode) { IDOMModel model = ((IDOMNode)child).getModel(); try { // tell the model that we are about to make a big model change model.aboutToChangeModel(); IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); formatProcessor.formatNode(child); } finally { // tell the model that we are done with the big model change model.changedModel(); } } }
protected void formatChild(Element child) { if (child instanceof IDOMNode) { IDOMModel model = ((IDOMNode)child).getModel(); try { // tell the model that we are about to make a big model change model.aboutToChangeModel(); IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); formatProcessor.formatNode(child); } finally { // tell the model that we are done with the big model change model.changedModel(); } } }
public static void formatChild(Node child) { if (child instanceof IDOMNode) { IDOMModel model = ((IDOMNode) child).getModel(); try { // tell the model that we are about to make a big model change model.aboutToChangeModel(); IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); formatProcessor.formatNode(child); } finally { // tell the model that we are done with the big model change model.changedModel(); } } }
IStructuredFormatProcessor formatProcessor = new FormatProcessorXML(); formatProcessor.formatNode(newElementNode);