/** * @param node */ private void refreshChildStyles(IDOMNode node) { NodeList childNodes = node.getChildNodes(); for (int i = 0, size = childNodes.getLength(); i < size; i++) { refreshChildStyles((IDOMNode) childNodes.item(i)); } if (node instanceof IDOMElement) { // only refresh style on element. ICSSStyle a = (ICSSStyle) node.getAdapterFor(ICSSStyle.class); if (a != null) { a.reset(); } } } }
/** * @param node */ private void refreshChildStyles(IDOMNode node) { NodeList childNodes = node.getChildNodes(); for (int i = 0, size = childNodes.getLength(); i < size; i++) { refreshChildStyles((IDOMNode) childNodes.item(i)); } if (node instanceof IDOMElement) { // only refresh style on element. ICSSStyle a = (ICSSStyle) node.getAdapterFor(ICSSStyle.class); if (a != null) { a.reset(); } } } }
if (((treeNode == null) || (((Node) treeNode).getNodeType() == Node.DOCUMENT_NODE)) && (completionRegion == null) && ((xmlnode == null) || (xmlnode.getChildNodes() == null) || (xmlnode.getChildNodes().getLength() == 0))) { IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(textViewer.getDocument()); try { if ((xmlnode.getNodeType() == Node.DOCUMENT_NODE) && ((completionRegion == null) || (xmlnode.getChildNodes() == null) || (xmlnode.getChildNodes().getLength() == 0))) { contentAssistRequest = computeStartDocumentProposals(documentPosition, matchString, completionRegion, (IDOMNode) treeNode, xmlnode); return contentAssistRequest.getCompletionProposals();
private IDOMNode compressEmptyElementTag(IDOMNode node) { boolean compressEmptyElementTags = getCleanupPreferences().getCompressEmptyElementTags(); IDOMNode newNode = node; IStructuredDocumentRegion startTagStructuredDocumentRegion = newNode.getFirstStructuredDocumentRegion(); IStructuredDocumentRegion endTagStructuredDocumentRegion = newNode.getLastStructuredDocumentRegion(); if (compressEmptyElementTags && startTagStructuredDocumentRegion != endTagStructuredDocumentRegion && startTagStructuredDocumentRegion != null) { ITextRegionList regions = startTagStructuredDocumentRegion.getRegions(); ITextRegion lastRegion = regions.get(regions.size() - 1); // format children and end tag if not empty element tag if (lastRegion.getType() != DOMRegionContext.XML_EMPTY_TAG_CLOSE) { NodeList childNodes = newNode.getChildNodes(); if (childNodes == null || childNodes.getLength() == 0 || (childNodes.getLength() == 1 && (childNodes.item(0)).getNodeType() == Node.TEXT_NODE && ((childNodes.item(0)).getNodeValue().trim().length() == 0))) { IDOMModel structuredModel = newNode.getModel(); IStructuredDocument structuredDocument = structuredModel.getStructuredDocument(); int startTagStartOffset = newNode.getStartOffset(); int offset = endTagStructuredDocumentRegion.getStart(); int length = endTagStructuredDocumentRegion.getLength(); structuredDocument.replaceText(structuredDocument, offset, length, ""); //$NON-NLS-1$ newNode = (IDOMNode) structuredModel.getIndexedRegion(startTagStartOffset); // save offset = startTagStructuredDocumentRegion.getStart() + lastRegion.getStart(); structuredDocument.replaceText(structuredDocument, offset, 0, "/"); //$NON-NLS-1$ newNode = (IDOMNode) structuredModel.getIndexedRegion(startTagStartOffset); // save } } } return newNode; }
return new DOMRefPosition(child, false); return new DOMPosition(parent, parent.getChildNodes() .getLength());
addTagInsertionProposals(contentAssistRequest, node.getChildNodes().getLength());