Package org.aspectj.org.eclipse.jdt.core

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


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


  private JavaElement getUnresolvedJavaElement() {
    if (isField()) {
      // field
      FieldBinding fieldBinding = (FieldBinding) this.binding;
      if (fieldBinding.declaringClass == null) return null; // arraylength
      IType declaringType = (IType) getDeclaringClass().getJavaElement();
      if (declaringType == null) return null;
      return (JavaElement) declaringType.getField(getName());
    }
    // local variable
    IMethodBinding declaringMethod = getDeclaringMethod();
    if (declaringMethod == null) return null;
    JavaElement method = (JavaElement) declaringMethod.getJavaElement();
View Full Code Here

          if (typeLength == 0) {
            String typeName = Util.getNameWithoutJavaLikeExtension(workingCopy.getElementName());
            typeMap.put(typeName, NO_TYPES);
          } else {
            for (int j = 0; j < typeLength; j++) {
              IType type = types[j];
              String typeName = type.getElementName();
              Object existing = typeMap.get(typeName);
              if (existing == null) {
                typeMap.put(typeName, type);
              } else if (existing instanceof IType) {
                typeMap.put(typeName, new IType[] {(IType) existing, type});
View Full Code Here

      IJavaProject javaProject = project;
      Map secondaryTypePaths = manager.secondaryTypes(javaProject, waitForIndexes, monitor);
      if (secondaryTypePaths.size() > 0) {
        Map types = (Map) secondaryTypePaths.get(packageName==null?"":packageName); //$NON-NLS-1$
        if (types != null && types.size() > 0) {
          IType type = (IType) types.get(typeName);
          if (type != null) {
            if (JavaModelManager.VERBOSE) {
              Util.verbose(" -> type: " + type.getElementName())//$NON-NLS-1$
            }
            return type;
          }
        }
      }
View Full Code Here

    JavaElementRequestor elementRequestor = new JavaElementRequestor();
    seekPackageFragments(packageName, false, elementRequestor);
    IPackageFragment[] packages= elementRequestor.getPackageFragments();

    // Try to find type in package fragments list
    IType type = null;
    int length= packages.length;
    HashSet projects = null;
    IJavaProject javaProject = null;
    Answer suggestedAnswer = null;
    for (int i= 0; i < length; i++) {
View Full Code Here

   * @see #ACCEPT_INTERFACES
   * @see #ACCEPT_ENUMS
   * @see #ACCEPT_ANNOTATIONS
   */
  public IType findType(String name, IPackageFragment pkg, boolean partialMatch, int acceptFlags, boolean considerSecondaryTypes) {
    IType type = findType(name, pkg, partialMatch, acceptFlags);
    if (type == null && considerSecondaryTypes) {
      type = findSecondaryType(pkg.getElementName(), name, pkg.getJavaProject(), false, null);
    }
    return type;
  }
View Full Code Here

      if (!partialMatch) {
        // exact match
        if (requestor.isCanceled()) return;
        ClassFile classFile =  new ClassFile((PackageFragment) pkg, name);
        if (classFile.existsUsingJarTypeCache()) {
          IType type = classFile.getType();
          if (acceptType(type, acceptFlags, false/*not a source type*/)) {
            requestor.acceptType(type);
          }
        }
      } else {
        IJavaElement[] classFiles= null;
        try {
          classFiles= pkg.getChildren();
        } catch (JavaModelException npe) {
          return; // the package is not present
        }
        int length= classFiles.length;
        String unqualifiedName = name;
        int index = name.lastIndexOf('$');
        if (index != -1) {
          //the type name of the inner type
          unqualifiedName = Util.localTypeName(name, index, name.length());
          // unqualifiedName is empty if the name ends with a '$' sign.
          // See http://dev.eclipse.org/bugs/show_bug.cgi?id=14642
        }
        int matchLength = name.length();
        for (int i = 0; i < length; i++) {
          if (requestor.isCanceled())
            return;
          IJavaElement classFile= classFiles[i];
          // MatchName will never have the extension ".class" and the elementName always will.
          String elementName = classFile.getElementName();
          if (elementName.regionMatches(true /*ignore case*/, 0, name, 0, matchLength)) {
            IType type = ((ClassFile) classFile).getType();
            String typeName = type.getElementName();
            if (typeName.length() > 0 && !Character.isDigit(typeName.charAt(0))) { //not an anonymous type
              if (nameMatches(unqualifiedName, type, true/*partial match*/) && acceptType(type, acceptFlags, false/*not a source type*/))
                requestor.acceptType(type);
            }
          }
 
View Full Code Here

            IJavaElement cu = compilationUnits[i];
            String cuName = cu.getElementName();
            int lastDot = cuName.lastIndexOf('.');
            if (lastDot != topLevelTypeName.length() || !topLevelTypeName.regionMatches(0, cuName, 0, lastDot))
              continue;
            IType type = ((ICompilationUnit) cu).getType(topLevelTypeName);
            type = getMemberType(type, name, firstDot);
            if (acceptType(type, acceptFlags, true/*a source type*/)) { // accept type checks for existence
              requestor.acceptType(type);
              break// since an exact match was requested, no other matching type can exist
            }
View Full Code Here

      isMemberTypePrefix = true;
    }
    for (int i= 0; i < length; i++) {
      if (requestor.isCanceled())
        return false;
      IType memberType= types[i];
      if (memberType.getElementName().toLowerCase().startsWith(memberPrefix))
        if (isMemberTypePrefix) {
          String subPrefix = prefix.substring(firstDot + 1, prefix.length());
          return seekTypesInType(subPrefix, subPrefix.indexOf('.'), memberType, requestor, acceptFlags);
        } else {
          if (acceptType(memberType, acceptFlags, true/*a source type*/)) {
View Full Code Here

    if (!partialMatch) {
      HashMap typeMap = (HashMap) (this.typesInWorkingCopies == null ? null : this.typesInWorkingCopies.get(pkg));
      if (typeMap != null) {
        Object object = typeMap.get(topLevelTypeName);
        if (object instanceof IType) {
          IType type = getMemberType((IType) object, name, firstDot);
          if (acceptType(type, acceptFlags, true/*a source type*/)) {
            requestor.acceptType(type);
            return true; // don't continue with compilation unit
          }
        } else if (object instanceof IType[]) {
          if (object == NO_TYPES) return true; // all types where deleted -> type is hidden
          IType[] topLevelTypes = (IType[]) object;
          for (int i = 0, length = topLevelTypes.length; i < length; i++) {
            if (requestor.isCanceled())
              return false;
            IType type = getMemberType(topLevelTypes[i], name, firstDot);
            if (acceptType(type, acceptFlags, true/*a source type*/)) {
              requestor.acceptType(type);
              return true; // return the first one
            }
          }
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.core.IType

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.