/** * shortcut method. Child class should always use this method to create a * text node. * * @param text * @return a new text node using text as the value */ public Text createText(String text) { return getDestDocument().createTextNode(text); }
public Text createText(String content) { return getDestDocument().createTextNode(content); }
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; } }
public void setModel(Object model) { super.setModel(model); _textNode = (Text) model; _cachedData = _textNode.getData(); _textNodeForFigure = getDestDocumentForDesign().createTextNode( _cachedData); }
/** * @param text * @return */ private Node createText(Text text) { Text previewText = this._destDocument.createTextNode(text.getData()); try { ((IDOMText) previewText).setSource(((IDOMText) text).getSource()); } catch (InvalidCharacterException e) { // "Error" _log.info("PreviewConvertContext.Error.0", e); //$NON-NLS-1$ } return previewText; }
/** * @param position * @return ?? */ protected IDOMPosition doContent(IDOMPosition position) { position = DOMPositionHelper.mergeIntoText(position); if (position.getContainerNode() instanceof Text) { Text text = (Text) position.getContainerNode(); String data = text.getData(); int offset = position.getOffset(); String newData = data.substring(0, offset) + _content + data.substring(offset); text.setData(newData); return new DOMPosition(text, offset + _content.length()); } // we need to create a text node. Text text = getDocument().createTextNode(_content); position.getContainerNode().insertBefore(text, position.getNextSiblingNode()); return new DOMRefPosition(text, true); }
String tail = data.substring(endOffset); Text middleText = getModel().getDocument().createTextNode(middle); Node parent = textNode.getParentNode(); parent.insertBefore( getModel().getDocument().createTextNode(before), textNode); Element bnode = createStyleElement(); bnode.appendChild(middleText); } else { Node parent = textNode.getParentNode(); parent.insertBefore(getModel().getDocument().createTextNode( before), textNode); Element bnode = createStyleElement();
/** * insertText method Can be called from subclasses, not to be overrided or * re-implemented. * */ protected void insertText(IStructuredDocumentRegion flatNode) { TextImpl text = (TextImpl) this.context.findPreviousText(); if (text != null) { // existing text found text.appendStructuredDocumentRegion(flatNode); // notify the change text.notifyValueChanged(); return; } // new text text = (TextImpl) this.model.getDocument().createTextNode(null); if (text == null) return; text.setStructuredDocumentRegion(flatNode); insertNode(text); }
text = (TextImpl) this.model.getDocument().createTextNode(null); if (text == null) return;