Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.SourceRange


      }
    } else {
      this.types[this.typeDepth] = getType(new String(typeInfo.name));
    }
    this.typeNameRanges[this.typeDepth] =
      new SourceRange(typeInfo.nameSourceStart, typeInfo.nameSourceEnd - typeInfo.nameSourceStart + 1);
    this.typeDeclarationStarts[this.typeDepth] = typeInfo.declarationStart;

    IType currentType = this.types[this.typeDepth];

    // type parameters
    if (typeInfo.typeParameters != null) {
      for (int i = 0, length = typeInfo.typeParameters.length; i < length; i++) {
        TypeParameterInfo typeParameterInfo = typeInfo.typeParameters[i];
        ITypeParameter typeParameter = currentType.getTypeParameter(new String(typeParameterInfo.name));
        setSourceRange(
          typeParameter,
          new SourceRange(
            typeParameterInfo.declarationStart,
            typeParameterInfo.declarationEnd - typeParameterInfo.declarationStart + 1),
          new SourceRange(
            typeParameterInfo.nameSourceStart,
            typeParameterInfo.nameSourceEnd - typeParameterInfo.nameSourceStart + 1));
      }
    }
View Full Code Here


   */
  public void enterField(FieldInfo fieldInfo) {
    if (this.typeDepth >= 0) {
      this.memberDeclarationStart[this.typeDepth] = fieldInfo.declarationStart;
      this.memberNameRange[this.typeDepth] =
        new SourceRange(fieldInfo.nameSourceStart, fieldInfo.nameSourceEnd - fieldInfo.nameSourceStart + 1);
      String fieldName = new String(fieldInfo.name);
      this.memberName[this.typeDepth] = fieldName;

      // categories
      IType currentType = this.types[this.typeDepth];
View Full Code Here

  }
  private void enterAbstractMethod(MethodInfo methodInfo) {
    if (this.typeDepth >= 0) {
      this.memberName[this.typeDepth] = new String(methodInfo.name);
      this.memberNameRange[this.typeDepth] =
        new SourceRange(methodInfo.nameSourceStart, methodInfo.nameSourceEnd - methodInfo.nameSourceStart + 1);
      this.memberDeclarationStart[this.typeDepth] = methodInfo.declarationStart;
      IType currentType = this.types[this.typeDepth];
      int currenTypeModifiers = this.typeModifiers[this.typeDepth];
      char[][] parameterTypes = methodInfo.parameterTypes;
      if (methodInfo.isConstructor && currentType.getDeclaringType() != null && !Flags.isStatic(currenTypeModifiers)) {
        IType declaringType = currentType.getDeclaringType();
        String declaringTypeName = declaringType.getElementName();
        if (declaringTypeName.length() == 0) {
          IClassFile classFile = declaringType.getClassFile();
          int length = parameterTypes != null ? parameterTypes.length : 0;
          char[][] newParameterTypes = new char[length+1][];
          declaringTypeName = classFile.getElementName();
          declaringTypeName = declaringTypeName.substring(0, declaringTypeName.indexOf('.'));
          newParameterTypes[0] = declaringTypeName.toCharArray();
          if (length != 0) {
            System.arraycopy(parameterTypes, 0, newParameterTypes, 1, length);
          }
          this.methodParameterTypes[this.typeDepth] = newParameterTypes;
        } else {
          int length = parameterTypes != null ? parameterTypes.length : 0;
          char[][] newParameterTypes = new char[length+1][];
          newParameterTypes[0] = declaringTypeName.toCharArray();
          if (length != 0) {
            System.arraycopy(parameterTypes, 0, newParameterTypes, 1, length);
          }
          this.methodParameterTypes[this.typeDepth] = newParameterTypes;
        }
      } else {
        this.methodParameterTypes[this.typeDepth] = parameterTypes;
      }
      this.methodParameterNames[this.typeDepth] = methodInfo.parameterNames;

      IMethod method = currentType.getMethod(
          this.memberName[this.typeDepth],
          convertTypeNamesToSigs(this.methodParameterTypes[this.typeDepth]));

      // type parameters
      if (methodInfo.typeParameters != null) {
        for (int i = 0, length = methodInfo.typeParameters.length; i < length; i++) {
          TypeParameterInfo typeParameterInfo = methodInfo.typeParameters[i];
          ITypeParameter typeParameter = method.getTypeParameter(new String(typeParameterInfo.name));
          setSourceRange(
            typeParameter,
            new SourceRange(
              typeParameterInfo.declarationStart,
              typeParameterInfo.declarationEnd - typeParameterInfo.declarationStart + 1),
            new SourceRange(
              typeParameterInfo.nameSourceStart,
              typeParameterInfo.nameSourceEnd - typeParameterInfo.nameSourceStart + 1));
        }
      }
      // parameters infos
      if (methodInfo.parameterInfos != null) {
        for (int i = 0, length = methodInfo.parameterInfos.length; i < length; i++) {
          ParameterInfo parameterInfo = methodInfo.parameterInfos[i];
          LocalVariableElementKey key = new LocalVariableElementKey(method, new String(parameterInfo.name));
          SourceRange[] allRanges = new SourceRange[] {
            new SourceRange(
              parameterInfo.declarationStart,
              parameterInfo.declarationEnd - parameterInfo.declarationStart + 1),
            new SourceRange(
              parameterInfo.nameSourceStart,
              parameterInfo.nameSourceEnd - parameterInfo.nameSourceStart + 1)
          };
          this.parametersRanges.put(
            key,
View Full Code Here

  public void exitType(int declarationEnd) {
    if (this.typeDepth >= 0) {
      IType currentType = this.types[this.typeDepth];
      setSourceRange(
        currentType,
        new SourceRange(
          this.typeDeclarationStarts[this.typeDepth],
          declarationEnd - this.typeDeclarationStarts[this.typeDepth] + 1),
        this.typeNameRanges[this.typeDepth]);
      this.typeDepth--;
    }
View Full Code Here

  public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) {
    if (this.typeDepth >= 0) {
      IType currentType = this.types[this.typeDepth];
      setSourceRange(
        currentType.getField(this.memberName[this.typeDepth]),
        new SourceRange(
          this.memberDeclarationStart[this.typeDepth],
          declarationEnd - this.memberDeclarationStart[this.typeDepth] + 1),
        this.memberNameRange[this.typeDepth]);
    }
  }
View Full Code Here

    exitAbstractMethod(declarationEnd);
  }
  private void exitAbstractMethod(int declarationEnd) {
    if (this.typeDepth >= 0) {
      IType currentType = this.types[this.typeDepth];
      SourceRange sourceRange =
        new SourceRange(
          this.memberDeclarationStart[this.typeDepth],
          declarationEnd - this.memberDeclarationStart[this.typeDepth] + 1);
      IMethod method = currentType.getMethod(
          this.memberName[this.typeDepth],
          convertTypeNamesToSigs(this.methodParameterTypes[this.typeDepth]));
View Full Code Here

    case ASTNode.INFIX_EXPRESSION: {
      final InfixExpression iexp = (InfixExpression) node;
      final InfixExpression.Operator op = iexp.getOperator();
      if (Util.isLegalInfixOperator(op)) {
        if (Util.inNeedOfTransformation(op)) {
          final ISourceRange range = new SourceRange(iexp
              .getStartPosition(), iexp.getLength());
          this.legalEncounteredInfixExpressionSourceLocations
              .add(range);
        }
        this.processExpression(iexp.getLeftOperand());
View Full Code Here

    case ASTNode.INFIX_EXPRESSION: {
      final InfixExpression ie = (InfixExpression) node;
      final InfixExpression.Operator op = ie.getOperator();
      if (Util.isLegalInfixOperator(op)) {
        if (Util.inNeedOfTransformation(op)) {
          final ISourceRange range = new SourceRange(ie
              .getStartPosition(), ie.getLength());
          this.legalEncounteredInfixExpressionSourceLocations
              .add(range);
        }
        this.processExpression(ie.getLeftOperand());
View Full Code Here

  protected void setNameSourceStart(int start) {
    this.nameStart= start;
  }

  protected ISourceRange getNameRange() {
    return new SourceRange(this.nameStart, this.nameEnd - this.nameStart + 1);
  }
View Full Code Here

*/
public int getSourceLength() {
  return this.sourceLength;
}
protected ISourceRange getSourceRange() {
  return new SourceRange(0, this.sourceLength);
}
View Full Code Here

TOP

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

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.