Package org.eclipse.jdt.internal.core

Examples of org.eclipse.jdt.internal.core.CancelableNameEnvironment


    IJavaProject javaProject,
    WorkingCopyOwner owner,
    int flags,
    IProgressMonitor monitor) {

    CancelableNameEnvironment environment = null;
    CancelableProblemFactory problemFactory = null;
    try {
      if (monitor != null) {
        int amountOfWork = (compilationUnits.length + bindingKeys.length) * 2; // 1 for beginToCompile, 1 for resolve
        monitor.beginTask("", amountOfWork); //$NON-NLS-1$
      }
      environment = new CancelableNameEnvironment(((JavaProject) javaProject), owner, monitor);
      problemFactory = new CancelableProblemFactory(monitor);
      CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
      compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
      CompilationUnitResolver resolver =
        new CompilationUnitResolver(
          environment,
          getHandlingPolicy(),
          compilerOptions,
          getRequestor(),
          problemFactory,
          monitor,
          javaProject != null);
      resolver.resolve(compilationUnits, bindingKeys, requestor, apiLevel, options, owner, flags);
      if (NameLookup.VERBOSE) {
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
      }
    } catch (JavaModelException e) {
      // project doesn't exist -> simple parse without resolving
      parse(compilationUnits, requestor, apiLevel, options, flags, monitor);
    } finally {
      if (monitor != null) monitor.done();
      if (environment != null) {
        environment.setMonitor(null); // don't hold a reference to this external object
      }
      if (problemFactory != null) {
        problemFactory.monitor = null; // don't hold a reference to this external object
      }
    }
View Full Code Here


            problemFactory,
            monitor,
            false);
        resolver.resolve(sourceUnits, encodings, bindingKeys, requestor, apiLevel, options, flags);
        if (NameLookup.VERBOSE && (environment instanceof CancelableNameEnvironment)) {
          CancelableNameEnvironment cancelableNameEnvironment = (CancelableNameEnvironment) environment;
          System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
          System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        }
      } finally {
        if (monitor != null) monitor.done();
View Full Code Here

      if (javaProject == null) {
        Classpath[] allEntries = new Classpath[classpaths.size()];
        classpaths.toArray(allEntries);
        environment = new NameEnvironmentWithProgress(allEntries, null, monitor);
      } else {
        environment = new CancelableNameEnvironment((JavaProject) javaProject, owner, monitor);
      }
      problemFactory = new CancelableProblemFactory(monitor);
      CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
      boolean ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
      compilerOptions.ignoreMethodBodies = ignoreMethodBodies;
      resolver =
        new CompilationUnitResolver(
          environment,
          getHandlingPolicy(),
          compilerOptions,
          getRequestor(),
          problemFactory,
          monitor,
          javaProject != null);
      boolean analyzeAndGenerateCode = !ignoreMethodBodies;
      unit =
        resolver.resolve(
          null, // no existing compilation unit declaration
          sourceUnit,
          nodeSearcher,
          true, // method verification
          analyzeAndGenerateCode, // analyze code
          analyzeAndGenerateCode); // generate code
      if (resolver.hasCompilationAborted) {
        // the bindings could not be resolved due to missing types in name environment
        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=86541
        CompilationUnitDeclaration unitDeclaration = parse(sourceUnit, nodeSearcher, options, flags);
        final int problemCount = unit.compilationResult.problemCount;
        if (problemCount != 0) {
          unitDeclaration.compilationResult.problems = new CategorizedProblem[problemCount];
          System.arraycopy(unit.compilationResult.problems, 0, unitDeclaration.compilationResult.problems, 0, problemCount);
          unitDeclaration.compilationResult.problemCount = problemCount;
        }
        return unitDeclaration;
      }
      if (NameLookup.VERBOSE && environment instanceof CancelableNameEnvironment) {
        CancelableNameEnvironment cancelableNameEnvironment = (CancelableNameEnvironment) environment;
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
      }
      return unit;
    } finally {
View Full Code Here

    IJavaProject javaProject,
    WorkingCopyOwner owner,
    int flags,
    IProgressMonitor monitor) {

    CancelableNameEnvironment environment = null;
    CancelableProblemFactory problemFactory = null;
    try {
      if (monitor != null) {
        int amountOfWork = (compilationUnits.length + bindingKeys.length) * 2; // 1 for beginToCompile, 1 for resolve
        monitor.beginTask("", amountOfWork); //$NON-NLS-1$
      }
      environment = new CancelableNameEnvironment(((JavaProject) javaProject), owner, monitor);
      problemFactory = new CancelableProblemFactory(monitor);
      CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
      compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
      CompilationUnitResolver resolver =
        new CompilationUnitResolver(
          environment,
          getHandlingPolicy(),
          compilerOptions,
          getRequestor(),
          problemFactory,
          monitor,
          javaProject != null);
      resolver.resolve(compilationUnits, bindingKeys, requestor, apiLevel, options, owner, flags);
      if (NameLookup.VERBOSE) {
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
      }
    } catch (JavaModelException e) {
      // project doesn't exist -> simple parse without resolving
      parse(compilationUnits, requestor, apiLevel, options, flags, monitor);
    } finally {
      if (monitor != null) monitor.done();
      if (environment != null) {
        environment.setMonitor(null); // don't hold a reference to this external object
      }
      if (problemFactory != null) {
        problemFactory.monitor = null; // don't hold a reference to this external object
      }
    }
View Full Code Here

            problemFactory,
            monitor,
            false);
        resolver.resolve(sourceUnits, encodings, bindingKeys, requestor, apiLevel, options, flags);
        if (NameLookup.VERBOSE && (environment instanceof CancelableNameEnvironment)) {
          CancelableNameEnvironment cancelableNameEnvironment = (CancelableNameEnvironment) environment;
          System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
          System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        }
      } finally {
        if (monitor != null) monitor.done();
View Full Code Here

      if (javaProject == null) {
        Classpath[] allEntries = new Classpath[classpaths.size()];
        classpaths.toArray(allEntries);
        environment = new NameEnvironmentWithProgress(allEntries, null, monitor);
      } else {
        environment = new CancelableNameEnvironment((JavaProject) javaProject, owner, monitor);
      }
      problemFactory = new CancelableProblemFactory(monitor);
      CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
      boolean ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
      compilerOptions.ignoreMethodBodies = ignoreMethodBodies;
      resolver =
        new CompilationUnitResolver(
          environment,
          getHandlingPolicy(),
          compilerOptions,
          getRequestor(),
          problemFactory,
          monitor,
          javaProject != null);
      boolean analyzeAndGenerateCode = !ignoreMethodBodies;
      unit =
        resolver.resolve(
          null, // no existing compilation unit declaration
          sourceUnit,
          nodeSearcher,
          true, // method verification
          analyzeAndGenerateCode, // analyze code
          analyzeAndGenerateCode); // generate code
      if (resolver.hasCompilationAborted) {
        // the bindings could not be resolved due to missing types in name environment
        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=86541
        CompilationUnitDeclaration unitDeclaration = parse(sourceUnit, nodeSearcher, options, flags);
        if (unit != null) {
          final int problemCount = unit.compilationResult.problemCount;
          if (problemCount != 0) {
            unitDeclaration.compilationResult.problems = new CategorizedProblem[problemCount];
            System.arraycopy(unit.compilationResult.problems, 0, unitDeclaration.compilationResult.problems, 0, problemCount);
            unitDeclaration.compilationResult.problemCount = problemCount;
          }
        } else if (resolver.abortProblem != null) {
          unitDeclaration.compilationResult.problemCount = 1;
          unitDeclaration.compilationResult.problems = new CategorizedProblem[] { resolver.abortProblem };
        }
        return unitDeclaration;
      }
      if (NameLookup.VERBOSE && environment instanceof CancelableNameEnvironment) {
        CancelableNameEnvironment cancelableNameEnvironment = (CancelableNameEnvironment) environment;
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
      }
      return unit;
    } finally {
View Full Code Here

    IJavaProject javaProject,
    WorkingCopyOwner owner,
    int flags,
    IProgressMonitor monitor) {

    CancelableNameEnvironment environment = null;
    CancelableProblemFactory problemFactory = null;
    try {
      if (monitor != null) {
        int amountOfWork = (compilationUnits.length + bindingKeys.length) * 2; // 1 for beginToCompile, 1 for resolve
        monitor.beginTask("", amountOfWork); //$NON-NLS-1$
      }
      environment = new CancelableNameEnvironment(((JavaProject) javaProject), owner, monitor);
      problemFactory = new CancelableProblemFactory(monitor);
      CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
      compilerOptions.ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
      CompilationUnitResolver resolver =
        new CompilationUnitResolver(
          environment,
          getHandlingPolicy(),
          compilerOptions,
          getRequestor(),
          problemFactory,
          monitor,
          javaProject != null);
      resolver.resolve(compilationUnits, bindingKeys, requestor, apiLevel, options, owner, flags);
      if (NameLookup.VERBOSE) {
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + environment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + environment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
      }
    } catch (JavaModelException e) {
      // project doesn't exist -> simple parse without resolving
      parse(compilationUnits, requestor, apiLevel, options, flags, monitor);
    } finally {
      if (monitor != null) monitor.done();
      if (environment != null) {
        environment.setMonitor(null); // don't hold a reference to this external object
      }
      if (problemFactory != null) {
        problemFactory.monitor = null; // don't hold a reference to this external object
      }
    }
View Full Code Here

            problemFactory,
            monitor,
            false);
        resolver.resolve(sourceUnits, encodings, bindingKeys, requestor, apiLevel, options, flags);
        if (NameLookup.VERBOSE && (environment instanceof CancelableNameEnvironment)) {
          CancelableNameEnvironment cancelableNameEnvironment = (CancelableNameEnvironment) environment;
          System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
          System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        }
      } finally {
        if (monitor != null) monitor.done();
View Full Code Here

      if (javaProject == null) {
        Classpath[] allEntries = new Classpath[classpaths.size()];
        classpaths.toArray(allEntries);
        environment = new NameEnvironmentWithProgress(allEntries, null, monitor);
      } else {
        environment = new CancelableNameEnvironment((JavaProject) javaProject, owner, monitor);
      }
      problemFactory = new CancelableProblemFactory(monitor);
      CompilerOptions compilerOptions = getCompilerOptions(options, (flags & ICompilationUnit.ENABLE_STATEMENTS_RECOVERY) != 0);
      boolean ignoreMethodBodies = (flags & ICompilationUnit.IGNORE_METHOD_BODIES) != 0;
      compilerOptions.ignoreMethodBodies = ignoreMethodBodies;
      resolver =
        new CompilationUnitResolver(
          environment,
          getHandlingPolicy(),
          compilerOptions,
          getRequestor(),
          problemFactory,
          monitor,
          javaProject != null);
      boolean analyzeAndGenerateCode = !ignoreMethodBodies;
      unit =
        resolver.resolve(
          null, // no existing compilation unit declaration
          sourceUnit,
          nodeSearcher,
          true, // method verification
          analyzeAndGenerateCode, // analyze code
          analyzeAndGenerateCode); // generate code
      if (resolver.hasCompilationAborted) {
        // the bindings could not be resolved due to missing types in name environment
        // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=86541
        CompilationUnitDeclaration unitDeclaration = parse(sourceUnit, nodeSearcher, options, flags);
        if (unit != null) {
          final int problemCount = unit.compilationResult.problemCount;
          if (problemCount != 0) {
            unitDeclaration.compilationResult.problems = new CategorizedProblem[problemCount];
            System.arraycopy(unit.compilationResult.problems, 0, unitDeclaration.compilationResult.problems, 0, problemCount);
            unitDeclaration.compilationResult.problemCount = problemCount;
          }
        } else if (resolver.abortProblem != null) {
          unitDeclaration.compilationResult.problemCount = 1;
          unitDeclaration.compilationResult.problems = new CategorizedProblem[] { resolver.abortProblem };
        }
        return unitDeclaration;
      }
      if (NameLookup.VERBOSE && environment instanceof CancelableNameEnvironment) {
        CancelableNameEnvironment cancelableNameEnvironment = (CancelableNameEnvironment) environment;
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInSourcePackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInSourcePackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
        System.out.println(Thread.currentThread() + " TIME SPENT in NameLoopkup#seekTypesInBinaryPackage: " + cancelableNameEnvironment.nameLookup.timeSpentInSeekTypesInBinaryPackage + "ms")//$NON-NLS-1$ //$NON-NLS-2$
      }
      return unit;
    } finally {
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.core.CancelableNameEnvironment

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.