Package org.eclipse.dltk.core.index2.search

Examples of org.eclipse.dltk.core.index2.search.ISearchRequestor


                    if (viewPath.contains(".")) {
                        viewPath = viewPath.substring(0, viewPath.indexOf("."));
                    }

                    Logger.debugMSG("add reference info: " + name +  " =>  " + viewPath + " with metadata " + metadata);
                    ReferenceInfo info = new ReferenceInfo(ISymfonyModelElement.TEMPLATE_VARIABLE, start, length, name, metadata, viewPath);
                    requestor.addReference(info);

                } else if (variable.isScalar()) {

                    name = variable.getName();
                    String method = variable.getMethod().getName();
                    String metadata = JsonUtils.createScalar(name, viewPath, method);

                    if (viewPath.contains(".")) {
                        viewPath = viewPath.substring(0, viewPath.indexOf("."));
                    }

                    Logger.debugMSG("add scalar info: " + name +  " => " + viewPath + " with metadata: "  + metadata );
                    ReferenceInfo info = new ReferenceInfo(ISymfonyModelElement.TEMPLATE_VARIABLE, start, length, name, metadata, viewPath);
                    requestor.addReference(info);
                } else {
                    Logger.debugMSG("Unable to resolve template variable: " + variable.getClass().toString());
                }
            }
View Full Code Here


                        SimpleReference varType = refs[1];

                        if(varName.getName().equals("$view") && varType.getName().equals("string")) {

                            int length = method.sourceEnd() - method.sourceStart();
                            ReferenceInfo viewMethod = new ReferenceInfo(ISymfonyModelElement.VIEW_METHOD, method.sourceStart()    , length, method.getName(), null, null);
                            requestor.addReference(viewMethod);

                        } else if (value.contains("route") || value.contains("url")) {

                            int length = method.sourceEnd() - method.sourceStart();
                            ReferenceInfo routeMethod = new ReferenceInfo(ISymfonyModelElement.ROUTE_METHOD, method.sourceStart(), length, method.getName(), null, null);
                            requestor.addReference(routeMethod);

                        }
                    }
                }
View Full Code Here

                    Logger.debugMSG("indexing twig tag: " + tag.getStartTag()
                            + " : " + tag.getEndTag() + " with metadata: "
                            + metadata.toString());

                    ReferenceInfo info = new ReferenceInfo(
                            ITwigModelElement.START_TAG,
                            currentClass.sourceStart(), length,
                            tag.getStartTag(), metadata.toString(), null);
                    addReferenceInfo(info);

                    if (endTag != null) {
                        ReferenceInfo endIinfo = new ReferenceInfo(
                                ITwigModelElement.END_TAG,
                                currentClass.sourceStart(), length,
                                tag.getEndTag(), metadata.toString(), null);
                        addReferenceInfo(endIinfo);
                    }
View Full Code Here

                    Logger.debugMSG("indexing test tag: "
                            + test.getElementName() + " with metadata: "
                            + test.getMetadata());

                    ReferenceInfo info = new ReferenceInfo(
                            ITwigModelElement.TEST, 0, 0,
                            test.getElementName(), test.getMetadata(), null);
                    addReferenceInfo(info);

                }
            }
        }

        for (Function function : functions) {

            for (MethodDeclaration method : methods) {

                if (method.getName().equals(function.getInternalFunction())) {

                    PHPMethodDeclaration phpMethod = (PHPMethodDeclaration) method;
                    PHPDocBlock doc = phpMethod.getPHPDoc();

                    if (doc != null) {
                        function.addDoc(doc);
                    }

                    function.addArgs(method.getArguments());

                    Logger.debugMSG("indexing function: "
                            + function.getElementName() + " with metadata: "
                            + function.getMetadata());
                    ReferenceInfo info = new ReferenceInfo(
                            ITwigModelElement.FUNCTION, 0, 0,
                            function.getElementName(), function.getMetadata(),
                            null);
                    addReferenceInfo(info);

                }
            }
        }

        for (Filter filter : filters) {

            for (MethodDeclaration method : methods) {

                if (method.getName().equals(filter.getInternalFunction())) {

                    PHPMethodDeclaration phpMethod = (PHPMethodDeclaration) method;
                    PHPDocBlock doc = phpMethod.getPHPDoc();

                    if (doc != null) {
                        filter.addDoc(doc);
                    }

                    filter.addArgs(method.getArguments());

                    Logger.debugMSG("indexing filter: "
                            + filter.getElementName() + " with metadata: "
                            + filter.getMetadata());
                    ReferenceInfo info = new ReferenceInfo(
                            ITwigModelElement.FILTER, 0, 0,
                            filter.getElementName(), filter.getMetadata(), null);
                    addReferenceInfo(info);

                }
View Full Code Here

    @Override
    public boolean visit(Variable s) throws Exception
    {
        if (blockTag != null) {
            Logger.debugMSG("Indexing block reference " + s.getValue()  + " in " + module.getElementName() + " / " + module.getScriptProject().getElementName());
            ReferenceInfo info = new ReferenceInfo(ITwigModelElement.BLOCK, s.sourceStart(), s.sourceEnd() - s.sourceStart(), s.getValue(), null, null);
            requestor.addReference(info);
        }
       
        return false;
    }
View Full Code Here

    @Override
    public boolean visit(StringLiteral s) throws Exception
    {
        if (extendsTag != null) {
            Logger.debugMSG("Indexing extends reference " + s.getValue());
            ReferenceInfo info = new ReferenceInfo(ITwigModelElement.EXTENDS, s.sourceStart(), s.sourceEnd() - s.sourceStart(), s.getValue(), null, null);     
            requestor.addReference(info);
        }
        return false;
    }
View Full Code Here

    createFile(data);
    ISourceModule sourceModule = DLTKCore.createSourceModuleFrom(testFile);

    IDLTKSearchScope scope = SearchEngine.createSearchScope(sourceModule,
        getSearchFlags(false));
    ISearchEngine searchEngine = ModelAccess.getSearchEngine(scope
        .getLanguageToolkit());
    final List<String> paths = new ArrayList<String>();
    if (searchEngine != null) {
      ISearchRequestor requestor = new ISearchRequestor() {
        public void match(int elementType, int flags, int offset,
            int length, int nameOffset, int nameLength,
            String elementName, String metadata, String doc,
            String qualifier, String parent,
            ISourceModule sourceModule, boolean isReference) {

          paths.add(sourceModule.getPath().toString());
        }
      };

      searchEngine.search(IModelElement.FIELD, null, "$testField", 0, 0,
          0, SearchFor.ALL_OCCURENCES, MatchRule.EXACT, scope,
          requestor, new NullProgressMonitor());

    }
    return paths;
View Full Code Here

        }

        // create a searchscope for the whole ScriptProject,
        // as view variables can be declared across controllers
        IDLTKSearchScope scope = SearchEngine.createSearchScope(controller.getScriptProject());
        ISearchEngine engine = ModelAccess.getSearchEngine(SymfonyLanguageToolkit.getDefault());
        final List<TemplateField> variables = new ArrayList<TemplateField>();
        if (scope == null || engine == null) {
            return variables;
        }

        final IElementResolver resolver = ModelAccess.getElementResolver(SymfonyLanguageToolkit.getDefault());
        engine.search(ISymfonyModelElement.TEMPLATE_VARIABLE, null, null, 0, 0, 100, SearchFor.REFERENCES, MatchRule.PREFIX, scope, new ISearchRequestor() {
            @Override
            public void match(int elementType, int flags, int offset, int length,
                    int nameOffset, int nameLength, String elementName,
                    String metadata, String doc, String qualifier, String parent,
                    ISourceModule sourceModule, boolean isReference) {
View Full Code Here

            return null;
        }

        // create a searchscope for the Controller class only
        IDLTKSearchScope scope = SearchEngine.createSearchScope(controller);
        ISearchEngine engine = ModelAccess.getSearchEngine(SymfonyLanguageToolkit.getDefault());
        if (scope == null || engine == null) {
            return null;
        }

        final List<TemplateField> variables = new ArrayList<TemplateField>();
        final IElementResolver resolver = ModelAccess.getElementResolver(SymfonyLanguageToolkit.getDefault());

        engine.search(ISymfonyModelElement.TEMPLATE_VARIABLE, null, variableName, 0, 0, 100, SearchFor.REFERENCES, MatchRule.EXACT, scope, new ISearchRequestor() {
            @Override
            public void match(int elementType, int flags, int offset, int length,
                    int nameOffset, int nameLength, String elementName,
                    String metadata, String doc, String qualifier, String parent,
                    ISourceModule sourceModule, boolean isReference) {
View Full Code Here

    }


    public Map<String, String> findAnnotationClasses(IScriptProject project) {
        IDLTKSearchScope scope = SearchEngine.createSearchScope(project.getScriptProject());
        ISearchEngine engine = ModelAccess.getSearchEngine(PHPLanguageToolkit.getDefault());

        final Map<String, String> annotations = new HashMap<String, String>();
        if (scope == null || engine == null) {
            return annotations;
        }

        engine.search(ISymfonyModelElement.ANNOTATION, null, null, 0, 0, 100, SearchFor.REFERENCES, MatchRule.PREFIX, scope, new ISearchRequestor() {
            @Override
            public void match(int elementType, int flags, int offset, int length,
                    int nameOffset, int nameLength, String elementName,
                    String metadata, String doc, String qualifier, String parent,
                    ISourceModule sourceModule, boolean isReference) {
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.core.index2.search.ISearchRequestor

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.