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

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


  synchronized IBinding resolveImport(ImportDeclaration importDeclaration) {
    if (this.scope == null) return null;
    try {
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.aspectj.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.aspectj.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.aspectj.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.aspectj.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.aspectj.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.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode node = (org.aspectj.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

    {

      CompilationResultDestinationManager manager = buildConfig.getCompilationResultDestinationManager();
      String sourceFolder = (manager == null ? null : manager.getSourceFolderForFile(sourceFile));

      ImportReference unitPackage = unit.currentPackage;

      // if (null == unitPackage) {
      // // Is there a sourceFolder to stick in?
      // if (sourceFolder == null) {
      // addToNode = structureModel.getRoot();
      // } else {
      // addToNode = findOrCreateChildSourceFolder(sourceFolder, structureModel);
      // }
      // } else {

      IProgramElement rootForSource = structureModel.getHierarchy().getRoot();
      if (sourceFolder != null) {
        rootForSource = findOrCreateChildSourceFolder(sourceFolder, structureModel);
      }
      String pkgName;
      if (unitPackage == null) {
        pkgName = "";
      } else {
        StringBuffer nameBuffer = new StringBuffer();
        final char[][] importName = unitPackage.getImportName();
        final int last = importName.length - 1;
        for (int i = 0; i < importName.length; i++) {
          nameBuffer.append(new String(importName[i]));
          if (i < last) {
            nameBuffer.append('.');
View Full Code Here

              path[k] = temp[k].toCharArray();
            }

            // Create the ImportReference needed to add a
            // ProgramElement
            ImportReference importRef = new ImportReference(path, new long[] { 0 }, false, 0);
            IProgramElement ceNode = new ProgramElement(activeStructureModel, importRef.toString(),
                IProgramElement.Kind.IMPORT_REFERENCE, makeLocation(importRef), 0, null, null);
            ceNode.setSourceSignature(genSourceSignature(importRef));
            // Add Element to Imports of Current Class
            ProgramElement imports = getImportReferencesRoot();// (ProgramElement) ((IProgramElement)
            // stack.peek()).getChildren().get(0);
View Full Code Here

    super(requestor, problemFactory, options, reportLocalDeclarations,
        optimizeStringLiterals, useSourceJavadocParser);
  }
 
  protected ImportReference newImportReference(char[][] tokens, long[] sourcePositions, boolean onDemand, int mod) {
    ImportReference ref = this.importReference;
    ref.tokens = tokens;
    ref.sourcePositions = sourcePositions;
    if (onDemand) {
      ref.bits |= ASTNode.OnDemand;
    }
View Full Code Here

  public static TypeDeclaration buildTypeDeclaration(IType type, CompilationUnitDeclaration compilationUnit, CompilationResult compilationResultthrows JavaModelException {
    PackageFragment pkg = (PackageFragment) type.getPackageFragment();
    char[][] packageName = Util.toCharArrays(pkg.names);
   
    if (packageName.length > 0) {
      compilationUnit.currentPackage = new ImportReference(packageName, new long[]{0}, false, ClassFileConstants.AccDefault);
    }
 
    /* convert type */
    TypeDeclaration typeDeclaration = convert(type, null, null, compilationResult);
   
View Full Code Here

TOP

Related Classes of org.aspectj.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.