Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.ISourceRange


          IType[] tTypes = wc.getTypes();
          int i = 0;
          int depth = 0;
          done : while(i < tTypes.length) {
            ISourceRange range = tTypes[i].getSourceRange();
            if(range.getOffset() <= start
                && range.getOffset() + range.getLength() >= end
                && tTypes[i].getElementName().equals(new String(compoundName[depth]))) {
              if(depth == compoundName.length - 1) {
                type = tTypes[i];
                break done;
              }
View Full Code Here


      parser.parseCompilationUnit(
        new BasicCompilationUnit(contents, null, this.binaryType.sourceFileName(info), javaElement),
        doFullParse,
        null/*no progress*/);
      if (elementToFind != null) {
        ISourceRange range = getNameRange(elementToFind);
        return range;
      } else {
        return null;
      }
    } finally {
View Full Code Here

      if (type != null && !type.isBinary()) {
        SourceType sourceType = (SourceType) type;
        IMember local = sourceType.getOuterMostLocalContext();
        if (local instanceof IMethod) { // remember this method's range so we don't purge its statements.
          try {
            ISourceRange range = local.getSourceRange();
            this.sourceStartOfMethodToRetain  = range.getOffset();
            this.sourceEndOfMethodToRetain = this.sourceStartOfMethodToRetain + range.getLength() - 1; // offset is 0 based.
          } catch (JavaModelException e) {
            // drop silently.
          }
        }
      }
View Full Code Here

  } while (token != TerminalTokens.TokenNameEOF);

}
protected void reportBinaryMemberDeclaration(IResource resource, IMember binaryMember, Binding binaryMemberBinding, IBinaryType info, int accuracy) throws CoreException {
  ClassFile classFile = (ClassFile) binaryMember.getClassFile();
  ISourceRange range = classFile.isOpen() ? binaryMember.getNameRange() : SourceMapper.UNKNOWN_RANGE;
  if (range.getOffset() == -1) {
    BinaryType type = (BinaryType) classFile.getType();
    String sourceFileName = type.sourceFileName(info);
    if (sourceFileName != null) {
      SourceMapper mapper = classFile.getSourceMapper();
      if (mapper != null) {
        char[] contents = mapper.findSource(type, sourceFileName);
        if (contents != null)
          range = mapper.mapSource(type, contents, info, binaryMember);
      }
    }
  }
  if (resource == null) resource =  this.currentPossibleMatch.resource;
  SearchMatch match = newDeclarationMatch(binaryMember, binaryMemberBinding, accuracy, range.getOffset(), range.getLength(), getParticipant(), resource);
  report(match);
}
View Full Code Here

    Annotation[] astAnnotations = new Annotation[length];
    if (length > 0) {
      char[] cuSource = getSource();
      int recordedAnnotations = 0;
      for (int i = 0; i < length; i++) {
        ISourceRange positions = annotations[i].getSourceRange();
        int start = positions.getOffset();
        int end = start + positions.getLength();
        char[] annotationSource = CharOperation.subarray(cuSource, start, end);
        if (annotationSource != null) {
            Expression expression = parseMemberValue(annotationSource);
            /*
             * expression can be null or not an annotation if the source has changed between
View Full Code Here

      if (type != null && !type.isBinary()) {
        SourceType sourceType = (SourceType) type;
        IMember local = sourceType.getOuterMostLocalContext();
        if (local instanceof IMethod) { // remember this method's range so we don't purge its statements.
          try {
            ISourceRange range = local.getSourceRange();
            this.sourceStartOfMethodToRetain  = range.getOffset();
            this.sourceEndOfMethodToRetain = this.sourceStartOfMethodToRetain + range.getLength() - 1; // offset is 0 based.
          } catch (JavaModelException e) {
            // drop silently.
          }
        }
      }
View Full Code Here

  } while (token != TerminalTokens.TokenNameEOF);

}
protected void reportBinaryMemberDeclaration(IResource resource, IMember binaryMember, Binding binaryMemberBinding, IBinaryType info, int accuracy) throws CoreException {
  ClassFile classFile = (ClassFile) binaryMember.getClassFile();
  ISourceRange range = classFile.isOpen() ? binaryMember.getNameRange() : SourceMapper.UNKNOWN_RANGE;
  if (range.getOffset() == -1) {
    BinaryType type = (BinaryType) classFile.getType();
    String sourceFileName = type.sourceFileName(info);
    if (sourceFileName != null) {
      SourceMapper mapper = classFile.getSourceMapper();
      if (mapper != null) {
        char[] contents = mapper.findSource(type, sourceFileName);
        if (contents != null)
          range = mapper.mapSource(type, contents, info, binaryMember);
      }
    }
  }
  if (resource == null) resource =  this.currentPossibleMatch.resource;
  SearchMatch match = newDeclarationMatch(binaryMember, binaryMemberBinding, accuracy, range.getOffset(), range.getLength(), getParticipant(), resource);
  report(match);
}
View Full Code Here

      parser.parseCompilationUnit(
        new BasicCompilationUnit(contents, null, this.binaryType.sourceFileName(info), javaElement),
        doFullParse,
        null/*no progress*/);
      if (elementToFind != null) {
        ISourceRange range = getNameRange(elementToFind);
        return range;
      } else {
        return null;
      }
    } finally {
View Full Code Here

    }
    return false;
  }

  public ASTNode search() throws JavaModelException {
    ISourceRange range = null;
    if (this.element instanceof IMember && !(this.element instanceof IInitializer))
      range = ((IMember) this.element).getNameRange();
    else
      range = this.element.getSourceRange();
    this.rangeStart = range.getOffset();
    this.rangeLength = range.getLength();
    this.ast.accept(this);
    return this.foundNode;
  }
View Full Code Here

        return null;

      int nameStart = computeCaptionOffset(document) + offset;

      try {
        ISourceRange sourceRange = fMember.getSourceRange();
        IMethod foldedMethod = lambdaMethod;

        if (foldedMethod != null && !foldedMethod.exists()) {
          foldedMethod = findLambdaMethodIn(fMember);
          if (foldedMethod != null) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.ISourceRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.