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

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

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

Annotation.getStartPosition介绍

暂无

代码示例

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

private void rewriteAnnotationsOnDimension(ArrayType oldArrayType, ArrayType replacingType, int index, int pos, boolean typeReplaced, TextEditGroup editGroup) throws CoreException {
  if (typeReplaced) {
    List dimensions = oldArrayType.dimensions();
    Dimension oldDim = index < dimensions.size() ? (Dimension) dimensions.get(index) : null;
    if (oldDim != null) {
      List oldAnnotations = oldDim.annotations();
      int size = oldAnnotations.size();
      if (size > 0) {
        ASTNode prev = getPreviousNode(oldDim);
        Annotation annotation = (Annotation) oldAnnotations.get(0);
        int start = prev != null ? prev.getStartPosition() + prev.getLength() : annotation.getStartPosition();
        annotation = (Annotation) oldAnnotations.get(size - 1);
        int end = annotation.getStartPosition() + annotation.getLength();
        end = getScanner().getTokenEndOffset(TerminalTokens.TokenNameLBRACKET, end) - 1;
        doTextRemove(start, end - start, editGroup);
      }
    }
    insertAnnotationsOnDimension(replacingType, index, pos, editGroup, true);
  } else {
    Dimension dim = (Dimension) replacingType.dimensions().get(index);
    rewriteNodeList(dim, Dimension.ANNOTATIONS_PROPERTY, pos, String.valueOf(' '), String.valueOf(' '), String.valueOf(' '));
  }
}

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

private void rewriteAnnotationsOnDimension(ArrayType oldArrayType, ArrayType replacingType, int index, int pos, boolean typeReplaced, TextEditGroup editGroup) throws CoreException {
  if (typeReplaced) {
    List dimensions = oldArrayType.dimensions();
    Dimension oldDim = index < dimensions.size() ? (Dimension) dimensions.get(index) : null;
    if (oldDim != null) {
      List oldAnnotations = oldDim.annotations();
      int size = oldAnnotations.size();
      if (size > 0) {
        ASTNode prev = getPreviousNode(oldDim);
        Annotation annotation = (Annotation) oldAnnotations.get(0);
        int start = prev != null ? prev.getStartPosition() + prev.getLength() : annotation.getStartPosition();
        annotation = (Annotation) oldAnnotations.get(size - 1);
        int end = annotation.getStartPosition() + annotation.getLength();
        end = getScanner().getTokenEndOffset(TerminalTokens.TokenNameLBRACKET, end) - 1;
        doTextRemove(start, end - start, editGroup);
      }
    }
    insertAnnotationsOnDimension(replacingType, index, pos, editGroup, true);
  } else {
    Dimension dim = (Dimension) replacingType.dimensions().get(index);
    rewriteNodeList(dim, Dimension.ANNOTATIONS_PROPERTY, pos, String.valueOf(' '), String.valueOf(' '), String.valueOf(' '));
  }
}

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

private void rewriteAnnotationsOnDimension(ArrayType oldArrayType, ArrayType replacingType, int index, int pos, boolean typeReplaced, TextEditGroup editGroup) throws CoreException {
  if (typeReplaced) {
    List dimensions = oldArrayType.dimensions();
    Dimension oldDim = index < dimensions.size() ? (Dimension) dimensions.get(index) : null;
    if (oldDim != null) {
      List oldAnnotations = oldDim.annotations();
      int size = oldAnnotations.size();
      if (size > 0) {
        ASTNode prev = getPreviousNode(oldDim);
        Annotation annotation = (Annotation) oldAnnotations.get(0);
        int start = prev != null ? prev.getStartPosition() + prev.getLength() : annotation.getStartPosition();
        annotation = (Annotation) oldAnnotations.get(size - 1);
        int end = annotation.getStartPosition() + annotation.getLength();
        end = getScanner().getTokenEndOffset(TerminalTokens.TokenNameLBRACKET, end) - 1;
        doTextRemove(start, end - start, editGroup);
      }
    }
    insertAnnotationsOnDimension(replacingType, index, pos, editGroup, true);
  } else {
    Dimension dim = (Dimension) replacingType.dimensions().get(index);
    rewriteNodeList(dim, Dimension.ANNOTATIONS_PROPERTY, pos, String.valueOf(' '), String.valueOf(' '), String.valueOf(' '));
  }
}

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

private void rewriteAnnotationsOnDimension(ArrayType oldArrayType, ArrayType replacingType, int index, int pos, boolean typeReplaced, TextEditGroup editGroup) throws CoreException {
  if (typeReplaced) {
    List dimensions = oldArrayType.dimensions();
    Dimension oldDim = index < dimensions.size() ? (Dimension) dimensions.get(index) : null;
    if (oldDim != null) {
      List oldAnnotations = oldDim.annotations();
      int size = oldAnnotations.size();
      if (size > 0) {
        ASTNode prev = getPreviousNode(oldDim);
        Annotation annotation = (Annotation) oldAnnotations.get(0);
        int start = prev != null ? prev.getStartPosition() + prev.getLength() : annotation.getStartPosition();
        annotation = (Annotation) oldAnnotations.get(size - 1);
        int end = annotation.getStartPosition() + annotation.getLength();
        end = getScanner().getTokenEndOffset(TerminalTokens.TokenNameLBRACKET, end) - 1;
        doTextRemove(start, end - start, editGroup);
      }
    }
    insertAnnotationsOnDimension(replacingType, index, pos, editGroup, true);
  } else {
    Dimension dim = (Dimension) replacingType.dimensions().get(index);
    rewriteNodeList(dim, Dimension.ANNOTATIONS_PROPERTY, pos, String.valueOf(' '), String.valueOf(' '), String.valueOf(' '));
  }
}

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

private void rewriteAnnotationsOnDimension(ArrayType oldArrayType, ArrayType replacingType, int index, int pos, boolean typeReplaced, TextEditGroup editGroup) throws CoreException {
  if (typeReplaced) {
    List dimensions = oldArrayType.dimensions();
    Dimension oldDim = index < dimensions.size() ? (Dimension) dimensions.get(index) : null;
    if (oldDim != null) {
      List oldAnnotations = oldDim.annotations();
      int size = oldAnnotations.size();
      if (size > 0) {
        ASTNode prev = getPreviousNode(oldDim);
        Annotation annotation = (Annotation) oldAnnotations.get(0);
        int start = prev != null ? prev.getStartPosition() + prev.getLength() : annotation.getStartPosition();
        annotation = (Annotation) oldAnnotations.get(size - 1);
        int end = annotation.getStartPosition() + annotation.getLength();
        end = getScanner().getTokenEndOffset(TerminalTokens.TokenNameLBRACKET, end) - 1;
        doTextRemove(start, end - start, editGroup);
      }
    }
    insertAnnotationsOnDimension(replacingType, index, pos, editGroup, true);
  } else {
    Dimension dim = (Dimension) replacingType.dimensions().get(index);
    rewriteNodeList(dim, Dimension.ANNOTATIONS_PROPERTY, pos, String.valueOf(' '), String.valueOf(' '), String.valueOf(' '));
  }
}

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

Annotation annotation = convert(typeAnnotation);
type.annotations().add(annotation);
annotationsEnd = annotation.getStartPosition() + annotation.getLength();

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

Annotation annotation = convert(typeAnnotation);
type.annotations().add(annotation);
annotationsEnd = annotation.getStartPosition() + annotation.getLength();

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

Annotation annotation = convert(typeAnnotation);
type.annotations().add(annotation);
annotationsEnd = annotation.getStartPosition() + annotation.getLength();

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

Annotation annotation = convert(typeAnnotation);
type.annotations().add(annotation);
annotationsEnd = annotation.getStartPosition() + annotation.getLength();

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

Annotation annotation = convert(typeAnnotation);
type.annotations().add(annotation);
annotationsEnd = annotation.getStartPosition() + annotation.getLength();

代码示例来源:origin: windup/windup

className,
status,
compilationUnit.getLineNumber(node.getStartPosition()),
compilationUnit.getColumnNumber(node.getStartPosition()),
node.getLength(),
node.toString());

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

List<Annotation> annotations= nameQualifiedType.annotations();
if (!annotations.isEmpty()) { // don't remove annotations
  simpleNameStart= annotations.get(0).getStartPosition();

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

List<Annotation> annotations= nameQualifiedType.annotations();
if (!annotations.isEmpty()) { // don't remove annotations
  simpleNameStart= annotations.get(0).getStartPosition();

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

if (noOfAnnotations > 0) {
  Annotation annotation= (Annotation) node.varargsAnnotations().get(noOfAnnotations - 1);
  int annotationEndPosition= annotation.getStartPosition() + annotation.getLength();
  ellipsisEnd= getScanner().getNextEndOffset(annotationEndPosition, true);
} else {

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

if (noOfAnnotations > 0) {
  Annotation annotation= (Annotation) node.varargsAnnotations().get(noOfAnnotations - 1);
  int annotationEndPosition= annotation.getStartPosition() + annotation.getLength();
  ellipsisEnd= getScanner().getNextEndOffset(annotationEndPosition, true);
} else {

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

if (noOfAnnotations > 0) {
  Annotation annotation= (Annotation) node.varargsAnnotations().get(noOfAnnotations - 1);
  int annotationEndPosition= annotation.getStartPosition() + annotation.getLength();
  ellipsisEnd= getScanner().getNextEndOffset(annotationEndPosition, true);
} else {

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

if (noOfAnnotations > 0) {
  Annotation annotation= (Annotation) node.varargsAnnotations().get(noOfAnnotations - 1);
  int annotationEndPosition= annotation.getStartPosition() + annotation.getLength();
  ellipsisEnd= getScanner().getNextEndOffset(annotationEndPosition, true);
} else {

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

if (noOfAnnotations > 0) {
  Annotation annotation= (Annotation) node.varargsAnnotations().get(noOfAnnotations - 1);
  int annotationEndPosition= annotation.getStartPosition() + annotation.getLength();
  ellipsisEnd= getScanner().getNextEndOffset(annotationEndPosition, true);
} else {

相关文章