Examples of IType


Examples of org.aspectj.org.eclipse.jdt.core.IType

      break;
    default:
      acceptFlags = NameLookup.ACCEPT_CLASSES;
      break;
  }
  IType type = null;
  if(isDeclaration) {
    type = resolveTypeByLocation(packageName, typeName, acceptFlags, start, end);
  } else {
    type = resolveType(packageName, typeName, acceptFlags);
    if(type != null ) {
      String key = uniqueKey == null ? type.getKey() : new String(uniqueKey);
      if(type.isBinary()) {
        ResolvedBinaryType resolvedType = new ResolvedBinaryType((JavaElement)type.getParent(), type.getElementName(), key);
        resolvedType.occurrenceCount = type.getOccurrenceCount();
        type = resolvedType;
      } else {
        ResolvedSourceType resolvedType = new ResolvedSourceType((JavaElement)type.getParent(), type.getElementName(), key);
        resolvedType.occurrenceCount = type.getOccurrenceCount();
        type = resolvedType;
      }
    }
  }

  if (type != null) {
    addElement(type);
    if(SelectionEngine.DEBUG){
      System.out.print("SELECTION - accept type("); //$NON-NLS-1$
      System.out.print(type.toString());
      System.out.println(")"); //$NON-NLS-1$
    }
  }
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

/**
* Resolve the field.
*/
public void acceptField(char[] declaringTypePackageName, char[] declaringTypeName, char[] name, boolean isDeclaration, char[] uniqueKey, int start, int end) {
  if(isDeclaration) {
    IType type= resolveTypeByLocation(declaringTypePackageName, declaringTypeName,
        NameLookup.ACCEPT_ALL,
        start, end);
    if(type != null) {
      try {
        IField[] fields = type.getFields();
        for (int i = 0; i < fields.length; i++) {
          IField field = fields[i];
          ISourceRange range = field.getNameRange();
          if(range.getOffset() <= start
              && range.getOffset() + range.getLength() >= end
              && field.getElementName().equals(new String(name))) {
            addElement(fields[i]);
            if(SelectionEngine.DEBUG){
              System.out.print("SELECTION - accept field("); //$NON-NLS-1$
              System.out.print(field.toString());
              System.out.println(")"); //$NON-NLS-1$
            }
            return; // only one method is possible
          }
        }
      } catch (JavaModelException e) {
        return;
      }
    }
  } else {
    IType type= resolveType(declaringTypePackageName, declaringTypeName, NameLookup.ACCEPT_ALL);
    if (type != null) {
      IField field= type.getField(new String(name));
      if (field.exists()) {
        if (uniqueKey != null) {
          if(field.isBinary()) {
            ResolvedBinaryField resolvedField = new ResolvedBinaryField(
                (JavaElement)field.getParent(),
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

  } else {
    SourceTypeBinding typeBinding = (SourceTypeBinding)fieldBinding.declaringClass;
    res = findLocalElement(typeBinding.sourceStart());
  }
  if (res != null && res.getElementType() == IJavaElement.TYPE) {
    IType type = (IType) res;
    IField field= type.getField(new String(fieldBinding.name));
    if (field.exists()) {
      char[] uniqueKey = fieldBinding.computeUniqueKey();
      if(field.isBinary()) {
        ResolvedBinaryField resolvedField = new ResolvedBinaryField(
            (JavaElement)field.getParent(),
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

  } else {
    SourceTypeBinding typeBinding = (SourceTypeBinding)typeVariableBinding.declaringElement;
    res = findLocalElement(typeBinding.sourceStart());
  }
  if (res != null && res.getElementType() == IJavaElement.TYPE) {
    IType type = (IType) res;
    ITypeParameter typeParameter = type.getTypeParameter(new String(typeVariableBinding.sourceName));
    if (typeParameter.exists()) {
      addElement(typeParameter);
      if(SelectionEngine.DEBUG){
        System.out.print("SELECTION - accept type parameter("); //$NON-NLS-1$
        System.out.print(typeParameter.toString());
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

  int previousElementIndex = this.elementIndex;
  this.elements = JavaElement.NO_ELEMENTS;
  this.elementIndex = -1;

  if(isDeclaration) {
    IType type = resolveTypeByLocation(declaringTypePackageName, declaringTypeName,
        NameLookup.ACCEPT_ALL,
        start, end);

    if(type != null) {
      this.acceptMethodDeclaration(type, selector, start, end);
    }
  } else {
    IType type = resolveType(declaringTypePackageName, declaringTypeName,
      NameLookup.ACCEPT_ALL);
    // fix for 1FWFT6Q
    if (type != null) {
      if (type.isBinary()) {

        // need to add a paramater for constructor in binary type
        IType declaringDeclaringType = type.getDeclaringType();

        boolean isStatic = false;
        try {
          isStatic = Flags.isStatic(type.getFlags());
        } catch (JavaModelException e) {
          // isStatic == false
        }

        if(declaringDeclaringType != null && isConstructor  && !isStatic) {
          int length = parameterPackageNames.length;
          System.arraycopy(parameterPackageNames, 0, parameterPackageNames = new char[length+1][], 1, length);
          System.arraycopy(parameterTypeNames, 0, parameterTypeNames = new char[length+1][], 1, length);
          System.arraycopy(parameterSignatures, 0, parameterSignatures = new String[length+1], 1, length);

          parameterPackageNames[0] = declaringDeclaringType.getPackageFragment().getElementName().toCharArray();
          parameterTypeNames[0] = declaringDeclaringType.getTypeQualifiedName().toCharArray();
          parameterSignatures[0] = Signature.getTypeErasure(enclosingDeclaringTypeSignature);
        }

        acceptBinaryMethod(type, selector, parameterPackageNames, parameterTypeNames, parameterSignatures, typeParameterNames, typeParameterBoundNames, uniqueKey, isConstructor);
      } else {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

    System.out.println(")"); //$NON-NLS-1$
  }
  return;
}
public void acceptTypeParameter(char[] declaringTypePackageName, char[] declaringTypeName, char[] typeParameterName, boolean isDeclaration, int start, int end) {
  IType type;
  if(isDeclaration) {
    type = resolveTypeByLocation(declaringTypePackageName, declaringTypeName,
        NameLookup.ACCEPT_ALL,
        start, end);
  } else {
    type = resolveType(declaringTypePackageName, declaringTypeName,
        NameLookup.ACCEPT_ALL);
  }

  if(type != null) {
    ITypeParameter typeParameter = type.getTypeParameter(new String(typeParameterName));
    if(typeParameter == null) {
      addElement(type);
      if(SelectionEngine.DEBUG){
        System.out.print("SELECTION - accept type("); //$NON-NLS-1$
        System.out.print(type.toString());
        System.out.println(")"); //$NON-NLS-1$
      }
    } else {
      addElement(typeParameter);
      if(SelectionEngine.DEBUG){
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

      }
    }
  }
}
public void acceptMethodTypeParameter(char[] declaringTypePackageName, char[] declaringTypeName, char[] selector,int selectorStart, int selectorEnd, char[] typeParameterName, boolean isDeclaration, int start, int end) {
  IType type = resolveTypeByLocation(declaringTypePackageName, declaringTypeName,
      NameLookup.ACCEPT_ALL,
      selectorStart, selectorEnd);

  if(type != null) {
    IMethod method = null;

    String name = new String(selector);
    IMethod[] methods = null;

    try {
      methods = type.getMethods();
      done : for (int i = 0; i < methods.length; i++) {
        ISourceRange range = methods[i].getNameRange();
        if(range.getOffset() >= selectorStart
            && range.getOffset() + range.getLength() <= selectorEnd
            && methods[i].getElementName().equals(name)) {
          method = methods[i];
          break done;
        }
      }
    } catch (JavaModelException e) {
      //nothing to do
    }

    if(method == null) {
      addElement(type);
      if(SelectionEngine.DEBUG){
        System.out.print("SELECTION - accept type("); //$NON-NLS-1$
        System.out.print(type.toString());
        System.out.println(")"); //$NON-NLS-1$
      }
    } else {
      ITypeParameter typeParameter = method.getTypeParameter(new String(typeParameterName));
      if(typeParameter == null) {
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

/**
* Resolve the type
*/
protected IType resolveType(char[] packageName, char[] typeName, int acceptFlags) {

  IType type= null;

  if (this.openable instanceof CompilationUnit && ((CompilationUnit)this.openable).isWorkingCopy()) {
    CompilationUnit wc = (CompilationUnit) this.openable;
    try {
      if(((packageName == null || packageName.length == 0) && wc.getPackageDeclarations().length == 0) ||
        (!(packageName == null || packageName.length == 0) && wc.getPackageDeclaration(new String(packageName)).exists())) {

        char[][] compoundName = CharOperation.splitOn('.', typeName);
        if(compoundName.length > 0) {
          type = wc.getType(new String(compoundName[0]));
          for (int i = 1, length = compoundName.length; i < length; i++) {
            type = type.getType(new String(compoundName[i]));
          }
        }

        if(type != null && !type.exists()) {
          type = null;
        }
      }
    }catch (JavaModelException e) {
      // type is null
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

  }
  return type;
}
protected IType resolveTypeByLocation(char[] packageName, char[] typeName, int acceptFlags, int start, int end) {

  IType type= null;

  // TODO (david) post 3.0 should remove isOpen check, and investigate reusing ICompilationUnit#getElementAt. may need to optimize #getElementAt to remove recursions
  if (this.openable instanceof CompilationUnit && ((CompilationUnit)this.openable).isOpen()) {
    CompilationUnit wc = (CompilationUnit) this.openable;
    try {
      if(((packageName == null || packageName.length == 0) && wc.getPackageDeclarations().length == 0) ||
        (!(packageName == null || packageName.length == 0) && wc.getPackageDeclaration(new String(packageName)).exists())) {

        char[][] compoundName = CharOperation.splitOn('.', typeName);
        if(compoundName.length > 0) {

          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;
              }
              tTypes = tTypes[i].getTypes();
              i = 0;
              depth++;
              continue done;
            }
            i++;
          }
        }

        if(type != null && !type.exists()) {
          type = null;
        }
      }
    }catch (JavaModelException e) {
      // type is null
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.core.IType

  if (innerTypes != null) {
    IPackageFragment pkg = (IPackageFragment) type.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
    for (int i = 0, typeCount = innerTypes.length; i < typeCount; i++) {
      IBinaryNestedType binaryType = innerTypes[i];
      IClassFile parentClassFile= pkg.getClassFile(new String(ClassFile.unqualifiedName(binaryType.getName())) + SUFFIX_STRING_class);
      IType innerType = new BinaryType((JavaElement) parentClassFile, ClassFile.simpleName(binaryType.getName()));
      childrenHandles.add(innerType);
    }
  }
}
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.