private boolean isStartTag(IStructuredDocumentRegion sdRegion) { boolean result = false; if (sdRegion.getRegions().size() > 0) { ITextRegion r = sdRegion.getRegions().get(0); result = (r.getType() == DOMRegionContext.XML_TAG_OPEN) && sdRegion.isEnded(); } return result; }
protected void findDirtyStart(int start) { IStructuredDocumentRegion result = fStructuredDocument.getRegionAtCharacterOffset(start); // heuristic: if the postion is exactly equal to the start, then // go back one more, if it exists. This prevents problems with // insertions // of text that should be merged with the previous node instead of // simply hung // off of it as a separate node (ex.: XML content inserted right // before an open // bracket should become part of the previous content node) if (result != null) { IStructuredDocumentRegion previous = result.getPrevious(); if ((previous != null) && ((!(previous.isEnded())) || (start == result.getStart()))) { result = previous; } // If we are now at the end of a "tag dependent" content area (or // JSP area) // then we need to back up all the way to the beginning of that. IStructuredDocumentRegion potential = result; while (isPartOfBlockRegion(potential)) { potential = potential.getPrevious(); } if (potential != null) { result = potential; fStructuredDocument.setCachedDocumentRegion(result); } } dirtyStart = result; }
@Override protected void findDirtyStart(int start) { IStructuredDocumentRegion result = fStructuredDocument.getRegionAtCharacterOffset(start); // heuristic: if the postion is exactly equal to the start, then // go back one more, if it exists. This prevents problems with // insertions // of text that should be merged with the previous node instead of // simply hung // off of it as a separate node (ex.: XML content inserted right // before an open // bracket should become part of the previous content node) if (result != null) { IStructuredDocumentRegion previous = result.getPrevious(); if ((previous != null) && ((!(previous.isEnded())) || (start == result.getStart()))) { result = previous; } // If we are now at the end of a "tag dependent" content area (or // JSP area) // then we need to back up all the way to the beginning of that. IStructuredDocumentRegion potential = result; while (isPartOfBlockRegion(potential)) { potential = potential.getPrevious(); } if (potential != null) { result = potential; fStructuredDocument.setCachedDocumentRegion(result); } } dirtyStart = result; }
if (((node != null) && (node.getAttributes() != null) && (node.getAttributes().getLength() > 0) && attributeInList(node, parent, elementDecl)) || ((node.getNodeType() != Node.TEXT_NODE) && node.getFirstStructuredDocumentRegion().isEnded())) {
String proposedText = aNode.getNodeName(); String proposedInfo = (ed != null) ? getAdditionalInfo(null, ed) : null; if ((node.getNodeType() == Node.TEXT_NODE) && !contentAssistRequest.getDocumentRegion().isEnded()) { proposedText += ">"; //$NON-NLS-1$
protected ContentAssistRequest computeAttributeProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node) { ContentAssistRequest contentAssistRequest = null; IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition); if (documentPosition < sdRegion.getStartOffset(completionRegion)) { // setup to insert new attributes contentAssistRequest = newContentAssistRequest(nodeAtOffset, node, sdRegion, completionRegion, documentPosition, 0, matchString); } else { // Setup to replace an existing attribute name contentAssistRequest = newContentAssistRequest(nodeAtOffset, node, sdRegion, completionRegion, sdRegion.getStartOffset(completionRegion), completionRegion.getTextLength(), matchString); } addAttributeNameProposals(contentAssistRequest); contentAssistRequest.setReplacementBeginPosition(documentPosition); contentAssistRequest.setReplacementLength(0); if ((node.getFirstStructuredDocumentRegion() != null) && (!node.getFirstStructuredDocumentRegion().isEnded())) { addTagCloseProposals(contentAssistRequest); } return contentAssistRequest; }
if ((result != null) && (!result.isEnded())) { if (result.getNext() != null) { result = result.getNext();
if ((result != null) && (!result.isEnded())) { if (result.getNext() != null) { result = result.getNext();
protected ContentAssistRequest computeAttributeValueProposals(int documentPosition, String matchString, ITextRegion completionRegion, IDOMNode nodeAtOffset, IDOMNode node) { ContentAssistRequest contentAssistRequest = null; IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition); if ((documentPosition > sdRegion.getStartOffset(completionRegion) + completionRegion.getTextLength()) && (sdRegion.getStartOffset(completionRegion) + completionRegion.getTextLength() != sdRegion.getStartOffset(completionRegion) + completionRegion.getLength())) { // setup to add a new attribute at the documentPosition IDOMNode actualNode = (IDOMNode) node.getModel().getIndexedRegion(sdRegion.getStartOffset(completionRegion)); contentAssistRequest = newContentAssistRequest(actualNode, actualNode, sdRegion, completionRegion, documentPosition, 0, matchString); addAttributeNameProposals(contentAssistRequest); if ((actualNode.getFirstStructuredDocumentRegion() != null) && !actualNode.getFirstStructuredDocumentRegion().isEnded()) { addTagCloseProposals(contentAssistRequest); } } else { // setup to replace the existing value if (!nodeAtOffset.getFirstStructuredDocumentRegion().isEnded() && (documentPosition < sdRegion.getStartOffset(completionRegion))) { // if the IStructuredDocumentRegion isn't closed and the // cursor is in front of the value, add contentAssistRequest = newContentAssistRequest(nodeAtOffset, node, sdRegion, completionRegion, documentPosition, 0, matchString); addAttributeNameProposals(contentAssistRequest); } else { contentAssistRequest = newContentAssistRequest(nodeAtOffset, node, sdRegion, completionRegion, sdRegion.getStartOffset(completionRegion), completionRegion.getTextLength(), matchString); addAttributeValueProposals(contentAssistRequest); } } return contentAssistRequest; }
if ((contentAssistRequest.getDocumentRegion() == node.getFirstStructuredDocumentRegion()) && !(node.getFirstStructuredDocumentRegion()).isEnded()) { setErrorMessage(null); else if ((contentAssistRequest.getDocumentRegion() == node.getLastStructuredDocumentRegion()) && !node.getLastStructuredDocumentRegion().isEnded()) { setErrorMessage(null);
if (parent.getRegions().size() == 1 && region.getType() == DOMRegionContext.XML_TAG_OPEN && (previous == null || (!previous.isEnded() || previous.getType() == DOMRegionContext.XML_CONTENT))) { result = true;
boolean insideTag = !sdRegion.isEnded() || (documentPosition <= sdRegion.getStartOffset(closeRegion)); if (insideTag) {
if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
if (!currentNode.isEnded()) { currentNode.setLength(region.getStart() - currentNode.getStart()); else if ((currentNode != null && currentNode.isEnded()) || (type == DOMRegionContext.XML_CONTENT) || (type == DOMRegionContext.XML_CHAR_REFERENCE) || (type == DOMRegionContext.XML_ENTITY_REFERENCE) || (type == DOMRegionContext.XML_PI_OPEN) || (type == DOMRegionContext.XML_TAG_OPEN) || (type == DOMRegionContext.XML_END_TAG_OPEN) || (type == DOMRegionContext.XML_COMMENT_OPEN) || (type == DOMRegionContext.XML_CDATA_OPEN) || (type == DOMRegionContext.XML_DECLARATION_OPEN)) { if (currentNode != null) { if (!currentNode.isEnded()) { currentNode.setLength(region.getStart() - currentNode.getStart());
if (!currentNode.isEnded()) { currentNode.setLength(region.getStart() - currentNode.getStart()); else if ((currentNode != null && currentNode.isEnded()) || (type == PHPRegionContext.PHP_OPEN) || (type == TwigRegionContext.TWIG_OPEN) || (type == TwigRegionContext.TWIG_STMT_OPEN) || (type == TwigRegionContext.TWIG_COMMENT_OPEN) || (type == DOMRegionContext.XML_CONTENT) if (!currentNode.isEnded()) { currentNode.setLength(region.getStart() - currentNode.getStart());
if (!currentNode.isEnded()) { currentNode.setLength(region.getStart() - currentNode.getStart()); else if ((currentNode != null && currentNode.isEnded()) || (type == DOMRegionContext.XML_CONTENT) || (type == DOMRegionContext.XML_CHAR_REFERENCE) || (type == DOMRegionContext.XML_ENTITY_REFERENCE) || (type == DOMRegionContext.XML_PI_OPEN) || (type == DOMRegionContext.XML_TAG_OPEN) || (type == DOMRegionContext.XML_END_TAG_OPEN) || (type == DOMRegionContext.XML_COMMENT_OPEN) || (type == DOMRegionContext.XML_CDATA_OPEN) || (type == DOMRegionContext.XML_DECLARATION_OPEN) || (type == DOMJSPRegionContexts.JSP_COMMENT_OPEN) || (type == DOMJSPRegionContexts.JSP_DECLARATION_OPEN) || (type == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN) || (type == DOMJSPRegionContexts.JSP_EXPRESSION_OPEN) || (type == DOMJSPRegionContexts.JSP_SCRIPTLET_OPEN) || (type == DOMJSPRegionContexts.JSP_CLOSE) || type == DOMJSPRegionContexts.JSP_EL_OPEN) { if (currentNode != null) { if (!currentNode.isEnded()) { currentNode.setLength(region.getStart() - currentNode.getStart());