本文整理汇总了Java中org.eclipse.wst.xml.core.internal.document.DocumentImpl类的典型用法代码示例。如果您正苦于以下问题:Java DocumentImpl类的具体用法?Java DocumentImpl怎么用?Java DocumentImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DocumentImpl类属于org.eclipse.wst.xml.core.internal.document包,在下文中一共展示了DocumentImpl类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newUiBinderRootElementProposalComputer
import org.eclipse.wst.xml.core.internal.document.DocumentImpl; //导入依赖的package包/类
/**
* Creates a proposal computer for autocompleting the root UiBinder element in
* a UiBinder XML file.
*/
public static IProposalComputer newUiBinderRootElementProposalComputer(
ContentAssistRequest contentAssistRequest) {
Node node = contentAssistRequest.getNode();
if (node == null) {
// No javadoc on getNode(), so play safe
return null;
}
if (node.getNodeType() == Node.ELEMENT_NODE) {
if (!XmlUtilities.getRootElement(node).equals(node)) {
// We are not the root element
return null;
}
} else if (node.getNodeType() == Node.TEXT_NODE) {
// A completion at "<_" produces a text node
if (node.getOwnerDocument().getDocumentElement() != null) {
// We are not the root element
return null;
}
} else {
// Some other node type
return null;
}
String newLine = ((DocumentImpl) node.getOwnerDocument()).getModel().getStructuredDocument().getLineDelimiter();
// Come up with <ui:UiBinder xmlns:ui="...">\n_\n</ui:UiBinder> text
String beforeCursorText = MessageFormat.format(
"ui:{0} xmlns:ui=\"{1}\">{2}",
UiBinderConstants.UI_BINDER_ELEMENT_NAME,
UiBinderConstants.UI_BINDER_XML_NAMESPACE, newLine);
String afterCursorText = MessageFormat.format("{0}</ui:{1}>", newLine,
UiBinderConstants.UI_BINDER_ELEMENT_NAME);
String fullText = beforeCursorText + afterCursorText;
String matchString = contentAssistRequest.getMatchString();
if (!fullText.startsWith(matchString)) {
return null;
}
int replaceOffset = contentAssistRequest.getReplacementBeginPosition();
return new StaticTextProposalComputer(new String[] {fullText}, matchString,
replaceOffset, matchString.length(), replaceOffset
+ beforeCursorText.length(),
XmlContentAssistUtilities.getImageForElement());
}
示例2: DOMDocumentForFM
import org.eclipse.wst.xml.core.internal.document.DocumentImpl; //导入依赖的package包/类
protected DOMDocumentForFM(DocumentImpl that) {
super(that);
}