Package org.eclipse.jdt.internal.compiler.ast

Examples of org.eclipse.jdt.internal.compiler.ast.ImportReference


      char[][] name = ((ReferenceBinding) type).compoundName;
      if (name.length <= ref.sourcePositions.length)
        end = (int) ref.sourcePositions[name.length - 1];
    }
  } else if (location instanceof ImportReference) {
    ImportReference ref = (ImportReference) location;
    if (isRecoveredName(ref.tokens)) return;
    if (type instanceof ReferenceBinding) {
      char[][] name = ((ReferenceBinding) type).compoundName;
      end = (int) ref.sourcePositions[name.length - 1];
    }
View Full Code Here


  synchronized IBinding resolveImport(ImportDeclaration importDeclaration) {
    if (this.scope == null) return null;
    try {
      org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(importDeclaration);
      if (node instanceof ImportReference) {
        ImportReference importReference = (ImportReference) node;
        final boolean isStatic = importReference.isStatic();
        if ((importReference.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0) {
          Binding binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, importReference.tokens.length), true, isStatic);
          if (binding != null) {
            if (isStatic) {
              if (binding instanceof org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
View Full Code Here

            return null;
          }
        }
      }
    } else if (node instanceof ImportReference) {
      ImportReference importReference = (ImportReference) node;
      int importReferenceLength = importReference.tokens.length;
      if (index >= 0) {
        Binding binding = null;
        if (this.scope == null) return null;
        if (importReferenceLength == index) {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), (importReference.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        } else {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), true, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        }
        if (binding != null) {
View Full Code Here

            return null;
          }
        }
      }
    } else if (node instanceof ImportReference) {
      ImportReference importReference = (ImportReference) node;
      int importReferenceLength = importReference.tokens.length;
      if (index >= 0) {
        Binding binding = null;
        if (this.scope == null) return null;
        if (importReferenceLength == index) {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), (importReference.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        } else {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), true, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        }
        if (binding != null) {
View Full Code Here

  synchronized IPackageBinding resolvePackage(PackageDeclaration pkg) {
    if (this.scope == null) return null;
    try {
      org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(pkg);
      if (node instanceof ImportReference) {
        ImportReference importReference = (ImportReference) node;
        Binding binding = this.scope.getTypeOrPackage(CharOperation.subarray(importReference.tokens, 0, importReference.tokens.length));
        if ((binding != null) && (binding.isValidBinding())) {
          if (binding instanceof ReferenceBinding) {
            // this only happens if a type name has the same name as its package
            ReferenceBinding referenceBinding = (ReferenceBinding) binding;
View Full Code Here

    this.scribe.setHeaderComment(headerEndPosition);

    /*
     * Package declaration
     */
    ImportReference currentPackage = compilationUnitDeclaration.currentPackage;
    final boolean hasPackage = currentPackage != null;
    if (hasPackage) {
      printComment();
      int blankLinesBeforePackage = this.preferences.blank_lines_before_package;
      if (blankLinesBeforePackage > 0) {
View Full Code Here

    char[][] qImportName = new char[length][];
    for (int i = 0; i < length; i++) {
      qImportName[i] = importName[i].toCharArray();
      positions[i] = position; // dummy positions
    }
    return new ImportReference(
      qImportName,
      positions,
      onDemand,
      modifiers);
  }
View Full Code Here

    int length = 0;
    ASTNode[] nodes = null;
    if (isInRange) {
      requestor.enterCompilationUnit();
    }
    ImportReference currentPackage = parsedUnit.currentPackage;
    ImportReference[] imports = parsedUnit.imports;
    TypeDeclaration[] types = parsedUnit.types;
    length =
      (currentPackage == null ? 0 : 1)
      + (imports == null ? 0 : imports.length)
      + (types == null ? 0 : types.length);
    nodes = new ASTNode[length];
    int index = 0;
    if (currentPackage != null) {
      nodes[index++] = currentPackage;
    }
    if (imports != null) {
      for (int i = 0, max = imports.length; i < max; i++) {
        nodes[index++] = imports[i];
      }
    }
    if (types != null) {
      for (int i = 0, max = types.length; i < max; i++) {
        nodes[index++] = types[i];
      }
    }
   
    // notify the nodes in the syntactical order
    if (length > 0) {
      quickSort(nodes, 0, length-1);
      for (int i=0;i<length;i++) {
        ASTNode node = nodes[i];
        if (node instanceof ImportReference) {
          ImportReference importRef = (ImportReference)node;
          if (node == parsedUnit.currentPackage) {
            notifySourceElementRequestor(importRef, true);
          } else {
            notifySourceElementRequestor(importRef, false);
          }
View Full Code Here

  synchronized IBinding resolveImport(ImportDeclaration importDeclaration) {
    if (this.scope == null) return null;
    try {
      org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.eclipse.jdt.internal.compiler.ast.ASTNode) this.newAstToOldAst.get(importDeclaration);
      if (node instanceof ImportReference) {
        ImportReference importReference = (ImportReference) node;
        final boolean isStatic = importReference.isStatic();
        if ((importReference.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0) {
          Binding binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, importReference.tokens.length), true, isStatic);
          if (binding != null) {
            if (isStatic) {
              if (binding instanceof org.eclipse.jdt.internal.compiler.lookup.TypeBinding) {
View Full Code Here

            return null;
          }
        }
      }
    } else if (node instanceof ImportReference) {
      ImportReference importReference = (ImportReference) node;
      int importReferenceLength = importReference.tokens.length;
      if (index >= 0) {
        Binding binding = null;
        if (this.scope == null) return null;
        if (importReferenceLength == index) {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), (importReference.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.OnDemand) != 0, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        } else {
          try {
            binding = this.scope.getImport(CharOperation.subarray(importReference.tokens, 0, index), true, importReference.isStatic());
          } catch (AbortCompilation e) {
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=53357
          }
        }
        if (binding != null) {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.compiler.ast.ImportReference

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.