Examples of IModelAccessCache


Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

    public boolean visit(ClassName classConst) {
      if (classConst.getName() instanceof Identifier) {

        String className = ((Identifier) classConst.getName())
            .getName();
        IModelAccessCache cache = classConst.getAST()
            .getBindingResolver().getModelAccessCache();
        try {
          IType[] types = PHPModelUtils.getTypes(className,
              getSourceModule(), classConst.getStart(), cache,
              new NullProgressMonitor());
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

        if (method != null && ModelUtils.isDeprecated(method)) {
          highlight(methodInvocation.getMethod().getFunctionName());

        }
      } else if (!(funcInv.getParent() instanceof MethodInvocation)) {
        IModelAccessCache cache = funcInv.getAST().getBindingResolver()
            .getModelAccessCache();
        if (cache != null) {
          String functionName = ModelUtils.getFunctionName(funcInv
              .getFunctionName());
          // functionName will be null if the function call looks like
          // ${func}(&$this),the ${func} is type of ReflectionVariable
          if (functionName != null) {
            Collection<IMethod> functions = cache
                .getGlobalFunctions(getSourceModule(),
                    functionName, null);
            if (functions != null) {
              for (IMethod function : functions) {
                if (ModelUtils.isDeprecated(function)) {
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

        .getModelElement();
    phpVersion = ProjectOptions.getPhpVersion(sourceModule
        .getScriptProject().getProject());

    // First, try to resolve using AST (if we have parsed it well):
    IModelAccessCache cache = new PerFileModelAccessCache(sourceModule) {
      @Override
      protected <T extends IModelElement> Collection<T> filterElements(
          ISourceModule sourceModule, Collection<T> elements,
          IProgressMonitor monitor) {
        // override/removes filtering because
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

  public IType[] getTypes() {
    if (types == null) {
      if (evaluatedType != null) {
        final ISourceModuleContext cnt = (ISourceModuleContext) context;
        IModelAccessCache cache = null;
        if (context instanceof IModelCacheContext) {
          cache = ((IModelCacheContext) context).getCache();
        }
        types = PHPTypeInferenceUtils.getModelElements(evaluatedType,
            cnt,
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

  public IGoal[] init() {
    final VariableReference variableReference = (VariableReference) ((ExpressionTypeGoal) goal)
        .getExpression();
    IContext context = goal.getContext();
    IModelAccessCache cache = null;
    if (context instanceof IModelCacheContext) {
      cache = ((IModelCacheContext) context).getCache();
    }
    // Handle $this variable reference
    if (variableReference.getName().equals("$this")) { //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

        .getSourceModule();
    IType[] types = typedGoal.getTypes();
    String methodName = typedGoal.getMethodName();

    IContext context = typedGoal.getContext();
    IModelAccessCache cache = null;
    if (context instanceof IModelCacheContext) {
      cache = ((IModelCacheContext) context).getCache();
    }

    List<IMethod> methods = new LinkedList<IMethod>();
    List<IType> methodTypes = new LinkedList<IType>();
    if (types == null) {
      try {
        methods.addAll(Arrays.asList(PHPModelUtils.getFunctions(
            methodName, sourceModule, 0, cache, null)));
        for (int i = 0, size = methods.size(); i < size; i++) {
          methodTypes.add(null);
        }
      } catch (ModelException e) {
        Logger.logException(e);
      }
    } else {
      try {
        for (IType type : types) {
          IMethod[] typeMethods = PHPModelUtils.getTypeMethod(type,
              methodName, true);
          if (typeMethods.length == 0) {
            ITypeHierarchy hierarchy = null;
            if (cache != null) {
              hierarchy = cache.getSuperTypeHierarchy(type, null);
            }
            typeMethods = PHPModelUtils
                .getSuperTypeHierarchyMethod(type, hierarchy,
                    methodName, true, null);
          }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

  public Object produceResult() {
    return result;
  }

  public IGoal[] subGoalDone(IGoal subgoal, Object result, GoalState state) {
    IModelAccessCache cache = null;
    if (goal.getContext() instanceof IModelCacheContext) {
      cache = (IModelAccessCache) ((IModelCacheContext) goal.getContext())
          .getCache();
    }
    if (state != GoalState.RECURSIVE) {
      if (result instanceof GeneratorClassType) {
        MultiTypeType type = new MultiTypeType();
        type.getTypes()
            .addAll(((GeneratorClassType) result).getTypes());
        this.result = type;
        return IGoal.NO_GOALS;
      } else if (result instanceof PHPClassType) {
        if (subgoal instanceof ExpressionTypeGoal) {
          ISourceModule sourceModule = ((ISourceModuleContext) subgoal
              .getContext()).getSourceModule();
          PHPClassType classType = (PHPClassType) result;
          List<IGoal> subGoals = new LinkedList<IGoal>();
          try {
            IType[] types = PHPModelUtils.getTypes(
                classType.getTypeName(), sourceModule, 0,
                cache, null);
            for (IType type : types) {
              IType[] superTypes = PHPModelUtils.getSuperClasses(
                  type,
                  cache == null ? null : cache
                      .getSuperTypeHierarchy(type, null));

              if (subgoal.getContext() instanceof MethodContext) {

                MethodContext methodContext = (MethodContext) subgoal
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

        SymfonyModelAccess model = SymfonyModelAccess.getDefault();
        IScriptProject project = context.getSourceModule().getScriptProject();
        SourceRange range = getReplacementRange(context);
        IDLTKSearchScope projectScope = SearchEngine.createSearchScope(context.getSourceModule().getScriptProject());
        DoctrineModelAccess doctrineModel =  DoctrineModelAccess.getDefault();
        IModelAccessCache cache = null;
        if (context instanceof IModelCacheContext) {
          cache = ((IModelCacheContext) context).getCache();
        }
        EntityAlias alias = context.getAlias();
        String prefix = context.getPrefix();
       
        if (alias.hasBundle() == false) {
            List<Bundle> bundles = model.findBundles(project);
            for (Bundle b : bundles) {
                IType[] bundleTypes = EMPTY_TYPES;
                if (cache != null) {
                  Collection<IType> types = cache.getTypes(context.getSourceModule(), b.getElementName(), null, null);
                  if (types != null) {
                    bundleTypes = types.toArray(new IType[types.size()]);
                  }
                } else {
                  bundleTypes = PhpModelAccess.getDefault().findTypes(b.getElementName(), MatchRule.EXACT, 0, 0, projectScope, null);
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

      }
      state = STATE_GOT_RECEIVER;
    }

    if (state == STATE_GOT_RECEIVER) {
      IModelAccessCache accessCache = null;
      if (goal.getContext() instanceof IModelCacheContext) {
        accessCache = ((IModelCacheContext)goal.getContext()).getCache();
      }
      try {
        IType[] types = typedGoal.getTypes();
        for (IType type : types) {
          String fq = type.getFullyQualifiedName(SLASH);
          IGoal result = checkName(fq);
          if (result != null) {
            return result;
          }
         
          IType[] superClasses = PHPModelUtils.getSuperClasses(type, accessCache != null ? accessCache.getSuperTypeHierarchy(type, null) : null);
          for (IType sc : superClasses) {
            result = checkName(sc.getFullyQualifiedName(SLASH));
            if (result != null) {
              return result;
            }
View Full Code Here

Examples of org.eclipse.php.internal.core.typeinference.IModelAccessCache

      }
      state = STATE_GOT_RECEIVER;
    }

    if (state == STATE_GOT_RECEIVER) {
      IModelAccessCache accessCache = null;
      if (goal.getContext() instanceof IModelCacheContext) {
        accessCache = ((IModelCacheContext)goal.getContext()).getCache();
      }
      try {
        IType[] types = typedGoal.getTypes();
        for (IType type : types) {
          String fq = type.getFullyQualifiedName(SLASH);
          IGoal result = checkName(fq);
          if (result != null) {
            return result;
          }
         
          IType[] superClasses = PHPModelUtils.getSuperClasses(type, accessCache != null ? accessCache.getSuperTypeHierarchy(type, null) : null);
          for (IType sc : superClasses) {
            result = checkName(sc.getFullyQualifiedName(SLASH));
            if (result != null) {
              return result;
            }
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.