本文整理匯總了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);
}