本文整理汇总了Java中com.sun.source.doctree.TextTree类的典型用法代码示例。如果您正苦于以下问题:Java TextTree类的具体用法?Java TextTree怎么用?Java TextTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextTree类属于com.sun.source.doctree包,在下文中一共展示了TextTree类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkReference
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
void checkReference(ReferenceTree tree, List<? extends DocTree> label) {
String sig = tree.getSignature();
Element found = trees.getElement(new DocTreePath(getCurrentPath(), tree));
if (found == null) {
System.err.println(sig + " NOT FOUND");
} else {
System.err.println(sig + " found " + found.getKind() + " " + found);
}
String expect = "UNKNOWN";
if (label.size() > 0 && label.get(0) instanceof TextTree)
expect = ((TextTree) label.get(0)).getBody();
if (!expect.equalsIgnoreCase(found == null ? "bad" : found.getKind().name())) {
error(tree, "Unexpected value found: " + found +", expected: " + expect);
}
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ReferenceTest.java
示例2: rewriteChildren
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
protected final LiteralTree rewriteChildren(LiteralTree tree) {
LiteralTree value = tree;
TextTree body = (TextTree) translate(tree.getBody());
if (body != tree.getBody()) {
if(tree.getKind() == DocTree.Kind.CODE) {
value = make.Code(body);
} else {
value = make.Literal(body);
}
}
return value;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ImmutableDocTreeTranslator.java
示例3: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
@Override
public DocTree visitText(TextTree node, Element p) {
if(renameInComments && refactoring.getContext().lookup(RenamePropertyRefactoringPlugin.class) == null) {
DocTreePath currentDocPath = getCurrentDocPath();
if(p.getKind() == ElementKind.PARAMETER) {
VariableElement var = (VariableElement) p;
Element method = workingCopy.getTrees().getElement(currentDocPath.getTreePath());
if(!var.getEnclosingElement().equals(method)) {
return super.visitText(node, p);
}
}
String originalName = getOldSimpleName(p);
if(node.getBody().contains(originalName)) {
StringBuilder text = new StringBuilder(node.getBody());
for (int index = text.indexOf(originalName); index != -1; index = text.indexOf(originalName, index + 1)) {
if (index > 0 && Character.isJavaIdentifierPart(text.charAt(index - 1))) {
continue;
}
if ((index + originalName.length() < text.length()) && Character.isJavaIdentifierPart(text.charAt(index + originalName.length()))) {
continue;
}
text.delete(index, index + originalName.length());
text.insert(index, newName);
}
if(!node.getBody().contentEquals(text)) {
TextTree newText = make.Text(text.toString());
rewrite(currentDocPath.getTreePath().getLeaf(), node, newText);
}
}
}
return super.visitText(node, p);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:RenameTransformer.java
示例4: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
@Override
public DocTree visitText(TextTree node, Element p) {
if(searchComment) {
DocTrees trees = info.getDocTrees();
DocSourcePositions sourcePositions = trees.getSourcePositions();
DocTreePath currentDocPath = getCurrentPath();
if(toFind.getKind() == ElementKind.PARAMETER) {
VariableElement var = (VariableElement) toFind;
Element method = trees.getElement(currentDocPath);
if(!var.getEnclosingElement().equals(method)) {
return super.visitText(node, p);
}
}
String text = node.getBody();
String name = toFind.getSimpleName().toString();
if(text.contains(name)) {
int start = (int) sourcePositions.getStartPosition(info.getCompilationUnit(), currentDocPath.getDocComment(), node);
int length = name.length();
int offset = -1;
do {
offset = text.indexOf(name, ++offset);
if(offset != -1) {
try {
MutablePositionRegion region = createRegion(doc, start + offset, start + offset + length);
comments.add(region);
} catch(BadLocationException ex) {
Exceptions.printStackTrace(ex);
}
}
} while (offset != -1);
}
}
return super.visitText(node, p);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:FindLocalUsagesQuery.java
示例5: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
@Override
public Void visitText(TextTree tree, Void ignore) {
if (hasNonWhitespace(tree)) {
checkAllowsText(tree);
markEnclosingTag(Flag.HAS_TEXT);
}
return null;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Checker.java
示例6: warnIfEmpty
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
void warnIfEmpty(DocTree tree, List<? extends DocTree> list) {
for (DocTree d: list) {
switch (d.getKind()) {
case TEXT:
if (hasNonWhitespace((TextTree) d))
return;
break;
default:
return;
}
}
env.messages.warning(SYNTAX, tree, "dc.empty", tree.getKind().tagName);
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:Checker.java
示例7: hasNonWhitespace
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
boolean hasNonWhitespace(TextTree tree) {
String s = tree.getBody();
for (int i = 0; i < s.length(); i++) {
if (!Character.isWhitespace(s.charAt(i)))
return true;
}
return false;
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:Checker.java
示例8: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public Object visitText(TextTree node, Object p) {
String text = node.getBody();
if (!pre) {
text = text.replaceAll("[ \t\r\n]+", " ").trim();
if (text.isEmpty()) {
text = " ";
}
} else {
text = text.replaceAll("\n", "\n" + indentString(indent));
}
result.append(text);
return null;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:JavadocFormatter.java
示例9: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitText(TextTree tree, Void ignore) {
hasNonWhitespaceText = hasNonWhitespace(tree);
if (hasNonWhitespaceText) {
checkAllowsText(tree);
markEnclosingTag(Flag.HAS_TEXT);
}
return null;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:Checker.java
示例10: hasNonWhitespace
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
boolean hasNonWhitespace(TextTree tree) {
String s = tree.getBody();
for (int i = 0; i < s.length(); i++) {
Character c = s.charAt(i);
if (!Character.isWhitespace(s.charAt(i)))
return true;
}
return false;
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:Checker.java
示例11: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitText(TextTree tree, Void ignore) {
if (hasNonWhitespace(tree)) {
checkAllowsText(tree);
markEnclosingTag(Flag.HAS_TEXT);
}
return null;
}
开发者ID:campolake,项目名称:openjdk9,代码行数:9,代码来源:Checker.java
示例12: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
@Override
public DocTree visitText(TextTree tree, Object p) {
return rewriteChildren(tree);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ImmutableDocTreeTranslator.java
示例13: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
@Override
public Void visitText(TextTree node, Void p) {
print(node.getBody());
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:VeryPretty.java
示例14: Literal
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
public com.sun.source.doctree.LiteralTree Literal(com.sun.source.doctree.TextTree text) {
return docMake.at(NOPOS).newLiteralTree(text);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:TreeFactory.java
示例15: Text
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
public TextTree Text(String text) {
return docMake.at(NOPOS).newTextTree(text);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:TreeFactory.java
示例16: Code
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
public com.sun.source.doctree.LiteralTree Code(TextTree text) {
return docMake.at(NOPOS).newCodeTree(text);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:TreeFactory.java
示例17: visitText
import com.sun.source.doctree.TextTree; //导入依赖的package包/类
/**
* @since 1.47
*/
@Override
public DocTree visitText(TextTree node, Element p) {
return docScanner.visitText(node, p, null);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:RefactoringVisitor.java
注:本文中的com.sun.source.doctree.TextTree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论