private String getText(ITextRegion region) { return (fParentRegion != null) ? fParentRegion.getText(region) : ""; //$NON-NLS-1$ }
String getText() { return fDocumentRegion.getText(fTextRegion); }
/** */ public String getSource() { if (this.flatNode == null) return new String(); return this.flatNode.getText(); }
/** */ public String getText() { if (this.flatNode == null) return new String(); String text = this.flatNode.getText(); if (text == null) return new String(); int end = this.offset + this.length; return text.substring(this.offset, end); }
/** */ public String getText() { int size = this.flatNodes.size(); if (size == 0) return new String(); StringBuffer buffer = new StringBuffer(); for (int i = 0; i < size; i++) { IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) this.flatNodes.elementAt(i); if (flatNode == null) continue; buffer.append(flatNode.getText()); } return buffer.toString(); }
protected String getAttributeValue(IStructuredDocumentRegion sdr, String attrName) { ITextRegion r = getAttributeValueRegion(sdr, attrName); if (r != null) return sdr.getText(r).trim(); return ""; //$NON-NLS-1$ }
public String getNameRegionText() { if (this.ownerElement == null) return null; // assuming the firstStructuredDocumentRegion is the one that contains // attributes IStructuredDocumentRegion flatNode = this.ownerElement.getFirstStructuredDocumentRegion(); if (flatNode == null) return null; return flatNode.getText(this.nameRegion); }
public String getValueRegionText() { if (this.ownerElement == null) return null; // assuming the firstStructuredDocumentRegion is the one that contains // attributes IStructuredDocumentRegion flatNode = this.ownerElement.getFirstStructuredDocumentRegion(); if (flatNode == null) return null; if (this.valueRegion == null) return null; return flatNode.getText(this.valueRegion); }
/** * */ public static int getTextLength(IStructuredDocumentRegionList nodes) { int length = 0; if (nodes != null) { for (Enumeration e = nodes.elements(); e.hasMoreElements();) { IStructuredDocumentRegion flatNode = (IStructuredDocumentRegion) e.nextElement(); if (flatNode != null) { length += flatNode.getText().length(); } } } return length; }
protected void updateStructuredDocumentRegion() { fStructuredDocumentRegion = fStructuredModel.getStructuredDocument().getRegionAtCharacterOffset(fCaretPosition); if (fStructuredDocumentRegion != null) { fStructuredDocumentRegionText = fStructuredDocumentRegion.getText(); } else { fStructuredDocumentRegionText = ""; //$NON-NLS-1$ } }
protected boolean firstStructuredDocumentRegionContainsLineDelimiters(IDOMNode node) { boolean result = false; if (node != null) { IStructuredDocumentRegion firstStructuredDocumentRegion = node.getFirstStructuredDocumentRegion(); if (firstStructuredDocumentRegion != null) { String firstStructuredDocumentRegionText = firstStructuredDocumentRegion.getText(); result = StringUtils.containsLineDelimiter(firstStructuredDocumentRegionText); } } return result; }
static private String getTagName(IStructuredDocumentRegion tag) { ITextRegionList regions = tag.getRegions(); Iterator iter = regions.iterator(); while (iter.hasNext()) { ITextRegion rgn = (ITextRegion) iter.next(); if (rgn.getType() == DOMRegionContext.XML_TAG_NAME) return tag.getText(rgn); } return "";//$NON-NLS-1$ }
protected void setStructuredDocumentRegionElementName(IDOMModel model, IStructuredDocumentRegion flatNode, String oldName, String newName) { if (flatNode != null) { String string = flatNode.getText(); int index = string.indexOf(oldName); if (index != -1) { index += flatNode.getStart(); model.getStructuredDocument().replaceText(this, index, oldName.length(), newName); } } } }
/** * @return java.lang.String */ public String getCssText() { if (getFirstStructuredDocumentRegion() == null) return generateSource(); StringBuffer str = new StringBuffer(getFirstStructuredDocumentRegion().getText()); IStructuredDocumentRegion node = getFirstStructuredDocumentRegion(); while (node != getLastStructuredDocumentRegion()) { node = node.getNext(); str.append(node.getText()); } return str.toString(); }
protected String getNodeText(IDOMNode node) { String text = null; if ((node instanceof CharacterDataImpl) && !(node instanceof CommentImpl) && !(node instanceof CDATASectionImpl) && !isJSPTag(node)) text = ((CharacterDataImpl) node).getSource(); else text = node.getFirstStructuredDocumentRegion().getText(); return text; }
/** * Computes the hover help for the attribute name */ protected String computeTagAttNameHelp(IDOMNode xmlnode, IDOMNode parentNode, IStructuredDocumentRegion flatNode, ITextRegion region) { CMElementDeclaration elementDecl = getCMElementDeclaration(xmlnode); String attName = flatNode.getText(region); CMAttributeDeclaration attDecl = getCMAttributeDeclaration(elementDecl, attName); return getAdditionalInfo(elementDecl, attDecl); }
/** * Verifies that the regions given, representing the contents of a * IStructuredDocumentRegion, includes a valid taglib directive or include * directive */ private boolean isTaglibOrInclude(IStructuredDocumentRegion node, ITextRegionList regions) { boolean sizeAndTypesMatch = (regions.size() > 1) && (regions.get(1).getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) && (regions.get(0).getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN || regions.get(0).getType() == DOMRegionContext.XML_TAG_OPEN); if (!sizeAndTypesMatch) return false; ITextRegion region = regions.get(1); String directiveName = node.getText(region); return sizeAndTypesMatch && (directiveName.equals(JSP11TLDNames.TAGLIB) || directiveName.equals(JSP11TLDNames.INCLUDE) || directiveName.equals(JSP12Namespace.ElementName.DIRECTIVE_TAGLIB) || directiveName.equals(JSP12Namespace.ElementName.DIRECTIVE_INCLUDE)); }
/** * Computes the hover help for the attribute value (this is the same as * the attribute name's help) */ protected String computeTagAttValueHelp(IDOMNode xmlnode, IDOMNode parentNode, IStructuredDocumentRegion flatNode, ITextRegion region) { CMElementDeclaration elementDecl = getCMElementDeclaration(xmlnode); ITextRegion attrNameRegion = getAttrNameRegion(xmlnode, region); String attName = flatNode.getText(attrNameRegion); CMAttributeDeclaration attDecl = getCMAttributeDeclaration(elementDecl, attName); return getAdditionalInfo(elementDecl, attDecl); }
private String getTagName(IStructuredDocumentRegion sdRegion) { ITextRegionList regions = sdRegion.getRegions(); ITextRegion region = null; String name = ""; //$NON-NLS-1$ for (int i = 0; i < regions.size(); i++) { region = regions.get(i); if (region.getType() == DOMRegionContext.XML_TAG_NAME) { name = sdRegion.getText(region); break; } } return name; }
private String getParentName(IStructuredDocumentRegion sdRegion) { String result = "UNKNOWN"; //$NON-NLS-1$ while (sdRegion != null && isValidJspActionRegionType(sdRegion.getType())) sdRegion = sdRegion.getPrevious(); if (sdRegion != null) { ITextRegionList regions = sdRegion.getRegions(); // only find parent names from a start tag if (regions.size() > 1) { ITextRegion r = regions.get(1); if (regions.get(0).getType().equals(DOMRegionContext.XML_TAG_OPEN) && r.getType().equals(DOMRegionContext.XML_TAG_NAME)) { result = sdRegion.getText(r); } } } return result; }