Examples of ISourceModuleContext


Examples of org.eclipse.dltk.ti.ISourceModuleContext

  }

  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,
            cnt instanceof MethodContext ? ((MethodContext) cnt)
                .getMethodNode().start() : cnt.getRootNode()
                .end(), cache);
      }
    }
    return types;
  }
View Full Code Here

Examples of org.eclipse.dltk.ti.ISourceModuleContext

      }
    }

    try {
      if (context instanceof ISourceModuleContext) {
        ISourceModuleContext typedContext = (ISourceModuleContext) context;
        ASTNode rootNode = typedContext.getRootNode();
        ASTNode localScopeNode = rootNode;
        if (context instanceof MethodContext) {
          localScopeNode = ((MethodContext) context).getMethodNode();
        }
        LocalReferenceDeclSearcher varDecSearcher = new LocalReferenceDeclSearcher(
            typedContext.getSourceModule(), variableReference,
            localScopeNode);
        rootNode.traverse(varDecSearcher);
        PHPModuleDeclaration phpModule = (PHPModuleDeclaration) rootNode;
        List<IGoal> subGoals = new LinkedList<IGoal>();
View Full Code Here

Examples of org.eclipse.dltk.ti.ISourceModuleContext

      if (!((NamespaceDeclaration) node).isGlobal()) {
        FileContext fileContext = (FileContext) contextStack.peek();
        fileContext.setNamespace(node.getName());
      }
    } else {
      ISourceModuleContext parentContext = (ISourceModuleContext) contextStack
          .peek();
      PHPClassType instanceType;
      if (parentContext instanceof INamespaceContext
          && ((INamespaceContext) parentContext).getNamespace() != null) {
        if (node instanceof TraitDeclaration) {
View Full Code Here

Examples of org.eclipse.dltk.ti.ISourceModuleContext

    String constantName = typedGoal.getConstantName();
    String typeName = typedGoal.getTypeName();

    IDLTKSearchScope scope = null;
    IScriptProject scriptProject = null;
    ISourceModuleContext sourceModuleContext = (ISourceModuleContext) goal
        .getContext();
    if (sourceModuleContext != null) {
      scriptProject = sourceModuleContext.getSourceModule()
          .getScriptProject();
      scope = SearchEngine.createSearchScope(scriptProject);
    }

    if (scope == null) {
View Full Code Here

Examples of org.eclipse.dltk.ti.ISourceModuleContext

  public IGoal[] init() {
    GlobalVariableReferencesGoal typedGoal = (GlobalVariableReferencesGoal) goal;

    IContext context = goal.getContext();
    ISourceModuleContext sourceModuleContext = null;
    IScriptProject scriptProject = null;
    if (context instanceof ISourceModuleContext) {
      sourceModuleContext = (ISourceModuleContext) context;
      scriptProject = sourceModuleContext.getSourceModule()
          .getScriptProject();
    }

    String variableName = typedGoal.getVariableName();

    boolean exploreOtherFiles = true;

    // Find all global variables from mixin

    IDLTKSearchScope scope = SearchEngine.createSearchScope(scriptProject);

    IField[] elements = PhpModelAccess.getDefault().findFields(
        variableName, MatchRule.EXACT, Modifiers.AccGlobal,
        Modifiers.AccConstant, scope, null);

    // if no element found, return empty array.
    if (elements == null) {
      return new IGoal[] {};
    }

    Map<ISourceModule, SortedSet<ISourceRange>> offsets = new HashMap<ISourceModule, SortedSet<ISourceRange>>();

    Comparator<ISourceRange> sourceRangeComparator = new Comparator<ISourceRange>() {
      public int compare(ISourceRange o1, ISourceRange o2) {
        return o1.getOffset() - o2.getOffset();
      }
    };

    for (IModelElement element : elements) {
      if (element instanceof SourceField) {
        SourceField sourceField = (SourceField) element;
        ISourceModule sourceModule = sourceField.getSourceModule();
        if (!offsets.containsKey(sourceModule)) {
          offsets.put(sourceModule, new TreeSet<ISourceRange>(
              sourceRangeComparator));
        }
        try {
          offsets.get(sourceModule).add(sourceField.getSourceRange());
        } catch (ModelException e) {
          if (DLTKCore.DEBUG) {
            e.printStackTrace();
          }
        }
      }
    }

    List<IGoal> subGoals = new LinkedList<IGoal>();
    for (Entry<ISourceModule, SortedSet<ISourceRange>> entry : offsets
        .entrySet()) {
      ISourceModule sourceModule = entry.getKey();
      if (exploreOtherFiles
          || (sourceModuleContext != null && sourceModuleContext
              .getSourceModule().equals(sourceModule))) {

        ModuleDeclaration moduleDeclaration = SourceParserUtil
            .getModuleDeclaration(sourceModule);
        SortedSet<ISourceRange> fileOffsets = entry.getValue();
View Full Code Here

Examples of org.eclipse.dltk.ti.ISourceModuleContext

    public GoalEvaluator createEvaluator(IGoal goal) {

        try {

            if (goal.getContext() instanceof ISourceModuleContext) {
              ISourceModuleContext context = (ISourceModuleContext) goal.getContext();
              IProjectNature nature = context.getSourceModule().getScriptProject().getProject().getNature(SymfonyNature.NATURE_ID);
              if(!(nature instanceof SymfonyNature)) {
          return null;
        }
            } else {
              return null;
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.