org.eclipse.jdt.core.dom.Javadoc.getParent()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.eclipse.jdt.core.dom.Javadoc.getParent()方法的一些代码示例,展示了Javadoc.getParent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Javadoc.getParent()方法的具体详情如下:
包路径:org.eclipse.jdt.core.dom.Javadoc
类名称:Javadoc
方法名:getParent

Javadoc.getParent介绍

暂无

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private MethodDeclaration resolveMethodDeclaration(ASTNode node) {
  if (node instanceof MethodDeclaration)
    return (MethodDeclaration)node;
  Javadoc doc= (Javadoc) ASTNodes.getParent(node, ASTNode.JAVADOC);
  if (doc == null)
    return null;
  if (doc.getParent() instanceof MethodDeclaration)
    return (MethodDeclaration) doc.getParent();
  return null;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools

@Override
public boolean visit(Javadoc node) {
  if (!fScanTags) {
    return false;
  }
  ASTNode parent = node.getParent();
  if (parent != null) {
    List<TagElement> tags = node.tags();
    validateTags(parent, tags);
  }
  return false;
}

代码示例来源:origin: usethesource/rascal

public boolean visit(Javadoc node) {
  ASTNode parent = node.getParent();
  if (parent == null) {
    parent = node.getAlternateRoot();
  }
  insert(documentation, resolveBinding(parent), getSourceLocation(node));
  return false;
}

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

private static ICompilationUnit createPreparedCU(ICompilationUnit cu, Javadoc comment, int wordStart) throws JavaModelException {
  int startpos= comment.getStartPosition();
  boolean isTopLevel= comment.getParent().getParent() instanceof CompilationUnit;
  char[] content= (char[]) cu.getBuffer().getCharacters().clone();
  if (isTopLevel && (wordStart + 6 < content.length)) {
    content[startpos++]= 'i'; content[startpos++]= 'm'; content[startpos++]= 'p';
    content[startpos++]= 'o'; content[startpos++]= 'r'; content[startpos++]= 't';
  }
  if (wordStart < content.length) {
    for (int i= startpos; i < wordStart; i++) {
      content[i]= ' ';
    }
  }
  /*
   * Explicitly create a new non-shared working copy.
   */
  ICompilationUnit newCU= cu.getWorkingCopy(null);
  newCU.getBuffer().setContents(content);
  return newCU;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

private static ICompilationUnit createPreparedCU(ICompilationUnit cu, Javadoc comment, int wordStart) throws JavaModelException {
  int startpos= comment.getStartPosition();
  boolean isTopLevel= comment.getParent().getParent() instanceof CompilationUnit;
  char[] content= cu.getBuffer().getCharacters().clone();
  if (isTopLevel && (wordStart + 6 < content.length)) {
    content[startpos++]= 'i'; content[startpos++]= 'm'; content[startpos++]= 'p';
    content[startpos++]= 'o'; content[startpos++]= 'r'; content[startpos++]= 't';
  }
  if (wordStart < content.length) {
    for (int i= startpos; i < wordStart; i++) {
      content[i]= ' ';
    }
  }
  /*
   * Explicitly create a new non-shared working copy.
   */
  ICompilationUnit newCU= cu.getWorkingCopy(null);
  newCU.getBuffer().setContents(content);
  return newCU;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private static ICompilationUnit createPreparedCU(ICompilationUnit cu, Javadoc comment, int wordStart) throws JavaModelException {
  int startpos= comment.getStartPosition();
  boolean isTopLevel= comment.getParent().getParent() instanceof CompilationUnit;
  char[] content= cu.getBuffer().getCharacters().clone();
  if (isTopLevel && (wordStart + 6 < content.length)) {
    content[startpos++]= 'i'; content[startpos++]= 'm'; content[startpos++]= 'p';
    content[startpos++]= 'o'; content[startpos++]= 'r'; content[startpos++]= 't';
  }
  if (wordStart < content.length) {
    for (int i= startpos; i < wordStart; i++) {
      content[i]= ' ';
    }
  }
  /*
   * Explicitly create a new non-shared working copy.
   */
  ICompilationUnit newCU= cu.getWorkingCopy(null);
  newCU.getBuffer().setContents(content);
  return newCU;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private static ICompilationUnit createPreparedCU(ICompilationUnit cu, Javadoc comment, int wordStart) throws JavaModelException {
  int startpos= comment.getStartPosition();
  boolean isTopLevel= comment.getParent().getParent() instanceof CompilationUnit;
  char[] content= cu.getBuffer().getCharacters().clone();
  if (isTopLevel && (wordStart + 6 < content.length)) {
    content[startpos++]= 'i'; content[startpos++]= 'm'; content[startpos++]= 'p';
    content[startpos++]= 'o'; content[startpos++]= 'r'; content[startpos++]= 't';
  }
  if (wordStart < content.length) {
    for (int i= startpos; i < wordStart; i++) {
      content[i]= ' ';
    }
  }
  /*
   * Explicitly create a new non-shared working copy.
   */
  ICompilationUnit newCU= cu.getWorkingCopy(null);
  newCU.getBuffer().setContents(content);
  return newCU;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core

@Override
public boolean visit(Javadoc node) {
  this.noFormatTagOpenStart = -1;
  this.formatCodeTagOpenEnd = -1;
  this.lastFormatCodeClosingTagIndex = -1;
  this.firstTagToken = null;
  this.ctm = null;
  int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC);
  Token commentToken = this.tm.get(commentIndex);
  if (node.getParent() == null) {
    // not a proper javadoc, treat as block comment
    handleWhitespaceAround(commentIndex);
  }
  if (commentIndex < this.tm.size() - 1)
    commentToken.breakAfter();
  if (handleFormatOnOffTags(commentToken))
    return false;
  boolean isHeader = this.tm.isInHeader(commentIndex);
  boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader)
      || (this.options.comment_format_header && isHeader);
  if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) {
    commentToken.setInternalStructure(commentToLines(commentToken, -1));
    return false;
  }
  this.commentStructure = commentToken.getInternalStructure();
  this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true);
  this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm);
  return true;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core

@Override
public boolean visit(Javadoc node) {
  this.noFormatTagOpenStart = -1;
  this.formatCodeTagOpenEnd = -1;
  this.lastFormatCodeClosingTagIndex = -1;
  this.firstTagToken = null;
  this.ctm = null;
  int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC);
  Token commentToken = this.tm.get(commentIndex);
  if (node.getParent() == null) {
    // not a proper javadoc, treat as block comment
    handleWhitespaceAround(commentIndex);
  }
  if (commentIndex < this.tm.size() - 1)
    commentToken.breakAfter();
  if (handleFormatOnOffTags(commentToken))
    return false;
  boolean isHeader = this.tm.isInHeader(commentIndex);
  boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader)
      || (this.options.comment_format_header && isHeader);
  if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) {
    commentToken.setInternalStructure(commentToLines(commentToken, -1));
    return false;
  }
  this.commentStructure = commentToken.getInternalStructure();
  this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true);
  this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm);
  return true;
}

代码示例来源:origin: io.spring.javaformat/spring-javaformat-formatter-eclipse

@Override
public boolean visit(Javadoc node) {
  this.noFormatTagOpenStart = -1;
  this.formatCodeTagOpenEnd = -1;
  this.lastFormatCodeClosingTagIndex = -1;
  this.firstTagToken = null;
  this.ctm = null;
  int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC);
  Token commentToken = this.tm.get(commentIndex);
  if (node.getParent() == null) {
    // not a proper javadoc, treat as block comment
    handleWhitespaceAround(commentIndex);
  }
  if (commentIndex < this.tm.size() - 1)
    commentToken.breakAfter();
  if (handleFormatOnOffTags(commentToken))
    return false;
  boolean isHeader = this.tm.isInHeader(commentIndex);
  boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader)
      || (this.options.comment_format_header && isHeader);
  if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) {
    commentToken.setInternalStructure(commentToLines(commentToken, -1));
    return false;
  }
  this.commentStructure = commentToken.getInternalStructure();
  this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true);
  this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm);
  return true;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
public boolean visit(Javadoc node) {
  this.noFormatTagOpenStart = -1;
  this.formatCodeTagOpenEnd = -1;
  this.lastFormatCodeClosingTagIndex = -1;
  this.firstTagToken = null;
  this.ctm = null;
  int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC);
  Token commentToken = this.tm.get(commentIndex);
  if (node.getParent() == null) {
    // not a proper javadoc, treat as block comment
    handleWhitespaceAround(commentIndex);
  }
  if (commentIndex < this.tm.size() - 1)
    commentToken.breakAfter();
  if (handleFormatOnOffTags(commentToken))
    return false;
  boolean isHeader = this.tm.isInHeader(commentIndex);
  boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader)
      || (this.options.comment_format_header && isHeader);
  if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) {
    commentToken.setInternalStructure(commentToLines(commentToken, -1));
    return false;
  }
  this.commentStructure = commentToken.getInternalStructure();
  this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true);
  this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm);
  handleJavadocTagAlignment(node);
  return true;
}

相关文章