/** * shortcut method. Child class should always use this method to create a * result element. * * @param tagName * @return a new element named tagName */ public Element createElement(String tagName) { return getDestDocument().createElement(tagName); }
public Element createElement(String tag) { return getDestDocument().createElement(tag); }
public static Element createDescriptionElement(IDOMDocument document, String text) { if (document == null) { return null; } Element span = document.createElement(IHTMLConstants.TAG_SPAN); //$NON-NLS-1$ span.setAttribute( "style", "color:gray;font-style:italic;font-size:normal;"); //$NON-NLS-1$ //$NON-NLS-2$ if (text == null) { span.appendChild(document.createTextNode(PDPlugin .getResourceString("ConverterUtil.Description"))); //$NON-NLS-1$ } else { span.appendChild(document.createTextNode(text)); } return span; } }
/** * @return a style element (cached on create) */ protected Element createStyleElement() { if (_applyingNode != null) { return _applyingNode; } Element element = getModel().getDocument().createElement(getTag()); if (_cssProperty != null && _cssPropertyValue != null) { element.setAttribute(_cssProperty, _cssPropertyValue); } return element; }
/** * @param creationData * @return {@link Element} */ protected final Element createElement(final CreationData creationData) { Element ele = creationData.getModel().getDocument().createElement(creationData.getTagName()); if (ele == null) return null; //ugly... fix me // TODO: move this into an ensure method? // XXX: we are using "startsWith("directive.")" to test whether // should setJSPTag, this // maybe is not the best way. Need check whether SSE have special // API for it. if (ITLDConstants.URI_JSP.equals(creationData.getUri()) && (ele.getLocalName().startsWith("directive.") || "declaration".equals(ele.getLocalName()) || "expression".equals(ele.getLocalName()) || "scriptlet" .equals(ele.getLocalName()))) { // it is a jsp tag ((IDOMElement) ele).setJSPTag(true); } if (creationData.getPrefix() != null) { ele.setPrefix(creationData.getPrefix()); } return ele; }
/** * create specified taglib declaration as jsp directive element * * @param model * @param uri * @param prefix * @return Element */ public static Element createTaglibDeclaration(IDOMModel model, String uri, String prefix) { Node[] ref = new Node[1]; BodyHelper.findHeaderInsertPosition(ITLDConstants.URI_JSP, "taglib", model.getDocument(), ref); Element ele = model.getDocument().createElement("jsp:directive.taglib"); ((IDOMElement) ele).setJSPTag(true); ele.setAttribute("uri", uri); ele.setAttribute("prefix", prefix); model.getDocument().insertBefore(ele, ref[0]); return ele; }
model.getDocument(), ref); Element ele = model.getDocument().createElement("jsp:directive.taglib"); ((IDOMElement) ele).setJSPTag(true); ele.setAttribute(ICSSPropertyID.ATTR_URI, uri);
/** * insertInvalidDecl method * */ private void insertInvalidDecl(IStructuredDocumentRegion flatNode) { ITextRegionList regions = flatNode.getRegions(); if (regions == null) return; ElementImpl element = null; try { element = (ElementImpl) this.model.getDocument().createElement("!");//$NON-NLS-1$ } catch (DOMException ex) { } if (element == null) { // invalid tag insertText(flatNode); // regard as invalid text return; } element.setEmptyTag(true); element.setStartStructuredDocumentRegion(flatNode); insertNode(element); }
element = (ElementImpl) this.model.getDocument().createElement(tagName);
element = (ElementImpl) this.model.getDocument().createElement(tagName);
end = (ElementImpl) this.model.getDocument().createElement(tagName);