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

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

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

Javadoc.getStartPosition介绍

暂无

代码示例

代码示例来源:origin: de.tudarmstadt.ukp.teaching.uima/de.tudarmstadt.ukp.teaching.uima.lesson2

@Override
  public boolean visit(Javadoc aNode)
  {
    new de.tudarmstadt.ukp.teaching.uima.lesson2.type.Javadoc(jcas, aNode
        .getStartPosition(), aNode.getStartPosition() + aNode.getLength()).addToIndexes();
    return false;
  }
}

代码示例来源:origin: JnRouvignac/AutoRefactor

private String addPeriodAtEndOfFirstLine(Javadoc node, String comment) {
  String beforeFirstTag = comment;
  String afterFirstTag = "";
  final Matcher m = FIRST_JAVADOC_TAG.matcher(comment);
  if (m.find()) {
    if (m.start() == 0) {
      return null;
    }
    beforeFirstTag = comment.substring(0, m.start());
    afterFirstTag = comment.substring(m.start());
  }
  final Matcher matcher = JAVADOC_WITHOUT_PUNCTUATION.matcher(beforeFirstTag);
  if (matcher.matches()) {
    final List<TagElement> tagElements = tags(node);
    if (tagElements.size() >= 2) {
      final TagElement firstLine = tagElements.get(0);
      final int relativeStart = firstLine.getStartPosition() - node.getStartPosition();
      final int endOfFirstLine = relativeStart + firstLine.getLength();
      return comment.substring(0, endOfFirstLine) + "." + comment.substring(endOfFirstLine);
      // TODO JNR do the replace here, not outside this method
    }
    return matcher.group(1) + "." + matcher.group(2) + afterFirstTag;
  }
  return null;
}

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

@Override
public boolean visit(Javadoc node) {
  if (!hasChildrenChanges(node)) {
    return doVisitUnchangedChildren(node);
  }
  int startPos= node.getStartPosition() + 3;
  String separator= getLineDelimiter() + getIndentAtOffset(node.getStartPosition())  + " * "; //$NON-NLS-1$
  rewriteNodeList(node, Javadoc.TAGS_PROPERTY, startPos, separator, separator);
  return false;
}

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

public boolean visit(Javadoc node) {
  if (!hasChildrenChanges(node)) {
    return doVisitUnchangedChildren(node);
  }
  int startPos= node.getStartPosition() + 3;
  String separator= getLineDelimiter() + getIndentAtOffset(node.getStartPosition())  + " * "; //$NON-NLS-1$
  rewriteNodeList(node, Javadoc.TAGS_PROPERTY, startPos, separator, separator);
  return false;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

public boolean visit(Javadoc node) {
  if (!hasChildrenChanges(node)) {
    return doVisitUnchangedChildren(node);
  }
  int startPos= node.getStartPosition() + 3;
  String separator= getLineDelimiter() + getIndentAtOffset(node.getStartPosition())  + " * "; //$NON-NLS-1$
  rewriteNodeList(node, Javadoc.TAGS_PROPERTY, startPos, separator, separator);
  return false;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

public boolean visit(Javadoc node) {
  if (!hasChildrenChanges(node)) {
    return doVisitUnchangedChildren(node);
  }
  int startPos= node.getStartPosition() + 3;
  String separator= getLineDelimiter() + getIndentAtOffset(node.getStartPosition())  + " * "; //$NON-NLS-1$
  rewriteNodeList(node, Javadoc.TAGS_PROPERTY, startPos, separator, separator);
  return false;
}

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

public boolean visit(Javadoc node) {
  if (!hasChildrenChanges(node)) {
    return doVisitUnchangedChildren(node);
  }
  int startPos= node.getStartPosition() + 3;
  String separator= getLineDelimiter() + getIndentAtOffset(node.getStartPosition())  + " * "; //$NON-NLS-1$
  rewriteNodeList(node, Javadoc.TAGS_PROPERTY, startPos, separator, separator);
  return false;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

public boolean visit(Javadoc node) {
  if (!hasChildrenChanges(node)) {
    return doVisitUnchangedChildren(node);
  }
  int startPos= node.getStartPosition() + 3;
  String separator= getLineDelimiter() + getIndentAtOffset(node.getStartPosition())  + " * "; //$NON-NLS-1$
  rewriteNodeList(node, Javadoc.TAGS_PROPERTY, startPos, separator, separator);
  return false;
}

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

@Override
ASTNode clone0(AST target) {
  Javadoc result = new Javadoc(target);
  result.setSourceRange(getStartPosition(), getLength());
  if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
    result.setComment(getComment());
  }
  result.tags().addAll(ASTNode.copySubtrees(target, tags()));
  return result;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

ASTNode clone0(AST target) {
  Javadoc result = new Javadoc(target);
  result.setSourceRange(getStartPosition(), getLength());
  if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
    result.setComment(getComment());
  }
  result.tags().addAll(ASTNode.copySubtrees(target, tags()));
  return result;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

ASTNode clone0(AST target) {
  Javadoc result = new Javadoc(target);
  result.setSourceRange(getStartPosition(), getLength());
  if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
    result.setComment(getComment());
  }
  result.tags().addAll(ASTNode.copySubtrees(target, tags()));
  return result;
}

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

ASTNode clone0(AST target) {
  Javadoc result = new Javadoc(target);
  result.setSourceRange(getStartPosition(), getLength());
  if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
    result.setComment(getComment());
  }
  result.tags().addAll(ASTNode.copySubtrees(target, tags()));
  return result;
}

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

ASTNode clone0(AST target) {
  Javadoc result = new Javadoc(target);
  result.setSourceRange(getStartPosition(), getLength());
  if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
    result.setComment(getComment());
  }
  result.tags().addAll(ASTNode.copySubtrees(target, tags()));
  return result;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

ASTNode clone0(AST target) {
  Javadoc result = new Javadoc(target);
  result.setSourceRange(getStartPosition(), getLength());
  if (this.ast.apiLevel == AST.JLS2_INTERNAL) {
    result.setComment(getComment());
  }
  result.tags().addAll(ASTNode.copySubtrees(target, tags()));
  return result;
}

代码示例来源: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: eclipse/eclipse.jdt.ls

Javadoc javadocNode = getPackageJavadocNode(fragment, source);
if (javadocNode != null) {
  int start = javadocNode.getStartPosition();
  int length = javadocNode.getLength();
  return new JavaDocCommentReader(source, start, start + length - 1);

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

protected static void copyJavadocNode(final ASTRewrite rewrite, final IMember member, final BodyDeclaration oldDeclaration, final BodyDeclaration newDeclaration) throws JavaModelException {
  final Javadoc predecessor= oldDeclaration.getJavadoc();
  if (predecessor != null) {
    final IDocument buffer= new Document(member.getCompilationUnit().getBuffer().getContents());
    try {
      final String[] lines= Strings.convertIntoLines(buffer.get(predecessor.getStartPosition(), predecessor.getLength()));
      Strings.trimIndentation(lines, member.getJavaProject(), false);
      final Javadoc successor= (Javadoc) rewrite.createStringPlaceholder(Strings.concatenate(lines, TextUtilities.getDefaultLineDelimiter(buffer)), ASTNode.JAVADOC);
      newDeclaration.setJavadoc(successor);
    } catch (BadLocationException exception) {
      JavaPlugin.log(exception);
    }
  }
}

相关文章