/** * Keeps text inline with its parent (no reflow necessary) * * @param node * @param doc * @param compressedText * @param parentNode */ private void handleNoReflow(IDOMNode node, IStructuredDocument doc, String compressedText, IDOMNode parentNode) { String nodeIndentation; // enough space and text has no line delimiters and (node has no // siblings or followed by inline comment) and // parentFirstStructuredDocumentRegionContainsLineDelimiters if (isEndTagMissing(parentNode)) { parentNode = (IDOMNode) parentNode.getParentNode(); while (isEndTagMissing(parentNode)) parentNode = (IDOMNode) parentNode.getParentNode(); // add parent's indentation to end nodeIndentation = getNodeIndent(parentNode); String lineDelimiter = getLineDelimiter(doc, node.getStartOffset()); if (!compressedText.endsWith(lineDelimiter + nodeIndentation)) { compressedText = StringUtils.appendIfNotEndWith(compressedText, lineDelimiter); compressedText = StringUtils.appendIfNotEndWith(compressedText, nodeIndentation); } } if ((parentNode != null) && (parentNode.getNodeType() == Node.DOCUMENT_NODE) && (node.getNodeValue().length() > 0) && (node.getNodeValue().trim().length() == 0) && ((node.getPreviousSibling() == null) || (node.getNextSibling() == null))) // delete spaces at the beginning or end of the document compressedText = EMPTY_STRING; replaceNodeValue(node, compressedText); }
if (isEndTagMissing(parentNode)) {