Examples of INameEnvironment


Examples of org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment

          options.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.IGNORE);
        }
      }
    }
  }
  INameEnvironment environment = null;
  try {
    this.context.evaluate(
      codeSnippet.toCharArray(),
      varTypeNames,
      varNames,
      localVariableModifiers,
      declaringType == null? null : declaringType.getFullyQualifiedName().toCharArray(),
      isStatic,
      isConstructorCall,
      environment = getBuildNameEnvironment(),
      options,
      getInfrastructureEvaluationRequestor(requestor),
      getProblemFactory());
  } catch (InstallException e) {
    handleInstallException(e);
  } finally {
    if (environment != null) environment.cleanup();
  }
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment

* @see IEvaluationContext#evaluateCodeSnippet(String, ICodeSnippetRequestor, IProgressMonitor)
*/
public void evaluateCodeSnippet(String codeSnippet, ICodeSnippetRequestor requestor, IProgressMonitor progressMonitor) throws JavaModelException {

  checkBuilderState();
  INameEnvironment environment = null;
  try {
    this.context.evaluate(
      codeSnippet.toCharArray(),
      environment = getBuildNameEnvironment(),
      this.project.getOptions(true),
      getInfrastructureEvaluationRequestor(requestor),
      getProblemFactory());
  } catch (InstallException e) {
    handleInstallException(e);
  } finally {
    if (environment != null) environment.cleanup();
  }
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment

* @see IEvaluationContext#evaluateVariable(IGlobalVariable, ICodeSnippetRequestor, IProgressMonitor)
*/
public void evaluateVariable(IGlobalVariable variable, ICodeSnippetRequestor requestor, IProgressMonitor progressMonitor) throws JavaModelException {

  checkBuilderState();
  INameEnvironment environment = null;
  try {
    this.context.evaluateVariable(
      ((GlobalVariableWrapper)variable).variable,
      environment = getBuildNameEnvironment(),
      this.project.getOptions(true),
      getInfrastructureEvaluationRequestor(requestor),
      getProblemFactory());
  } catch (InstallException e) {
    handleInstallException(e);
  } finally {
    if (environment != null) environment.cleanup();
  }
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment

* @see IEvaluationContext#validateImports(ICodeSnippetRequestor)
*/
public void validateImports(ICodeSnippetRequestor requestor) {
 
  checkBuilderState();
  INameEnvironment environment = null;
  try {
    this.context.evaluateImports(
      environment = getBuildNameEnvironment(),
      getInfrastructureEvaluationRequestor(requestor),
      getProblemFactory());
  } finally {
    if (environment != null) environment.cleanup();
  }
}
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment

    this.resolver = resolver;
  }

  public IAnnotationBinding[] getAnnotations() {
    try {
      INameEnvironment nameEnvironment = this.binding.environment.nameEnvironment;
      if (!(nameEnvironment instanceof SearchableEnvironment))
        return AnnotationBinding.NoAnnotations;
      NameLookup nameLookup = ((SearchableEnvironment) nameEnvironment).nameLookup;
      if (nameLookup == null)
        return AnnotationBinding.NoAnnotations;
      final String pkgName = getName();
      IPackageFragment[] pkgs = nameLookup.findPackageFragments(pkgName, false/*exact match*/);
      if (pkgs == null)
        return AnnotationBinding.NoAnnotations;

      for (int i = 0, len = pkgs.length; i < len; i++) {
        int fragType = pkgs[i].getKind();
        switch(fragType) {
          case IPackageFragmentRoot.K_SOURCE:
            String unitName = "package-info.java"; //$NON-NLS-1$
            ICompilationUnit unit = pkgs[i].getCompilationUnit(unitName);
            if (unit != null) {
              ASTParser p = ASTParser.newParser(AST.JLS3);
              p.setSource(unit);
              p.setResolveBindings(true);
              p.setUnitName(unitName);
              p.setFocalPosition(0);
              p.setKind(ASTParser.K_COMPILATION_UNIT);
              CompilationUnit domUnit = (CompilationUnit) p.createAST(null);
              PackageDeclaration pkgDecl = domUnit.getPackage();
              if (pkgDecl != null) {
                List annos = pkgDecl.annotations();
                if (annos == null || annos.isEmpty())
                  return AnnotationBinding.NoAnnotations;
                IAnnotationBinding[] result = new IAnnotationBinding[annos.size()];
                int index=0;
                 for (Iterator it = annos.iterator(); it.hasNext(); index++) {
                  result[index] = ((Annotation) it.next()).resolveAnnotationBinding();
                  // not resolving bindings
                  if (result[index] == null)
                    return AnnotationBinding.NoAnnotations;
                }
                return result;
              }
            }
            break;
          case IPackageFragmentRoot.K_BINARY:
            NameEnvironmentAnswer answer =
              nameEnvironment.findType(TypeConstants.PACKAGE_INFO_NAME, this.binding.compoundName);
            if (answer != null && answer.isBinaryType()) {
              IBinaryType type = answer.getBinaryType();
              IBinaryAnnotation[] binaryAnnotations = type.getAnnotations();
              org.aspectj.org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding[] binaryInstances =
                BinaryTypeBinding.createAnnotations(binaryAnnotations, this.binding.environment);
View Full Code Here

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment

  /*
   * @see IBinding#getJavaElement()
   */
  public IJavaElement getJavaElement() {
    INameEnvironment nameEnvironment = this.binding.environment.nameEnvironment; // a package binding always has a LooupEnvironment set
    if (!(nameEnvironment instanceof SearchableEnvironment)) return null;
    NameLookup nameLookup = ((SearchableEnvironment) nameEnvironment).nameLookup;
    if (nameLookup == null) return null;
    IJavaElement[] pkgs = nameLookup.findPackageFragments(getName(), false/*exact match*/);
    if (pkgs == null) return null;
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.env.INameEnvironment

  protected String compileUnits(final JRCompilationUnit[] units, String classpath, File tempDirFile)
  {
    final StringBuffer problemBuffer = new StringBuffer();


    INameEnvironment env = getNameEnvironment(units);

    final IErrorHandlingPolicy policy =
      DefaultErrorHandlingPolicies.proceedWithAllProblems();

    final Map settings = getJdtSettings();
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.env.INameEnvironment

    return null
  }

  protected INameEnvironment getNameEnvironment(final JRCompilationUnit[] units)
  {
    final INameEnvironment env = new INameEnvironment()
    {
      public NameEnvironmentAnswer findType(char[][] compoundTypeName)
      {
        StringBuffer result = new StringBuffer();
        String sep = "";
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.env.INameEnvironment

                }
                return result;
            }
        }

        final INameEnvironment env = new INameEnvironment() {

                public NameEnvironmentAnswer
                    findType(char[][] compoundTypeName) {
                    String result = "";
                    String sep = "";
View Full Code Here

Examples of org.eclipse.jdt.internal.compiler.env.INameEnvironment

        IProblemFactory problemFactory = new DefaultProblemFactory(Locale.ENGLISH);

        /**
         * To find types ...
         */
        INameEnvironment nameEnvironment = new NameEnv(this);

        /**
         * Compilation result
         */
        ICompilerRequestor compilerRequestor = new CompilerRequestor(this);
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.