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

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


     * @return
     */
    public Filter[] getFilters(IScriptProject scriptProject)
    {
        IDLTKSearchScope scope = SearchEngine.createSearchScope(scriptProject);
        ISearchEngine engine = ModelAccess.getSearchEngine(PHPLanguageToolkit
                .getDefault());

        final JSONParser parser = new JSONParser();
        final List<Filter> filters = new ArrayList<Filter>();

        engine.search(ITwigModelElement.FILTER, null, null, 0, 0, 100,
                SearchFor.REFERENCES, MatchRule.PREFIX, scope,
                new ISearchRequestor()
                {

                    @Override
View Full Code Here


        if (tagCache.get(cacheKey) != null) {
            return true;
        }

        ISearchEngine engine = ModelAccess.getSearchEngine(PHPLanguageToolkit
                .getDefault());

        final JSONParser parser = new JSONParser();

        final List<String> tags = new ArrayList<String>();

        engine.search(type, null, text, 0, 0, 1, SearchFor.REFERENCES,
                MatchRule.EXACT, scope, new ISearchRequestor()
                {

                    @Override
                    public void match(int elementType, int flags, int offset,
View Full Code Here

        if (tagCache.get(cacheKey) != null) {
            String cached = (String) tagCache.get(cacheKey);
            return cached == null || cached.length() == 0;
        }

        ISearchEngine engine = ModelAccess.getSearchEngine(PHPLanguageToolkit
                .getDefault());
        final List<String> tags = new ArrayList<String>();

        engine.search(type, null, text, 0, 0, 1, SearchFor.REFERENCES,
                MatchRule.EXACT, scope, new ISearchRequestor()
                {

                    @Override
                    public void match(int elementType, int flags, int offset,
View Full Code Here

     */
    public Tag[] findTags(IScriptProject scriptProject)
    {

        IDLTKSearchScope scope = SearchEngine.createSearchScope(scriptProject);
        ISearchEngine engine = ModelAccess.getSearchEngine(PHPLanguageToolkit
                .getDefault());

        final List<Tag> tags = new ArrayList<Tag>();
        final JSONParser parser = new JSONParser();

        engine.search(ITwigModelElement.START_TAG, null, null, 0, 0, 200,
                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)
                    {

                        try {

                            Tag tag = new Tag(elementName);

                            if (metadata != null) {

                                JSONObject data = (JSONObject) parser
                                        .parse(new StringReader(metadata));
                                if (data.size() > 0)
                                    tag.setPhpClass((String) data
                                            .get(TwigType.PHPCLASS));

                                if (data.size() > 1)
                                    tag.setDescription((String) data
                                            .get(TwigType.DOC));

                            }
                            tags.add(tag);

                        } catch (Exception e) {
                            e.printStackTrace();
                        }

                    }
                }, null);

        engine.search(ITwigModelElement.END_TAG, null, null, 0, 0, 200,
                SearchFor.REFERENCES, MatchRule.PREFIX, scope,
                new ISearchRequestor()
                {

                    @Override
View Full Code Here

    public Test[] getTests(IScriptProject scriptProject)
    {

        IDLTKSearchScope scope = SearchEngine.createSearchScope(scriptProject);
        ISearchEngine engine = ModelAccess.getSearchEngine(PHPLanguageToolkit
                .getDefault());

        final JSONParser parser = new JSONParser();

        final List<Test> tests = new ArrayList<Test>();

        engine.search(ITwigModelElement.TEST, null, null, 0, 0, 100,
                SearchFor.REFERENCES, MatchRule.PREFIX, scope,
                new ISearchRequestor()
                {

                    @Override
View Full Code Here

     */
    public List<BlockName> findBlocks(SourceModule sourceModule,
            IScriptProject scriptProject)
    {
        IDLTKSearchScope scope = SearchEngine.createSearchScope(sourceModule);
        ISearchEngine engine = ModelAccess.getSearchEngine(PHPLanguageToolkit.getDefault());
        final List<BlockName> blocks = new ArrayList<BlockName>();
       
        ISearchRequestor requestor = 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)
            {
                BlockName blockName = new BlockName(sourceModule, elementName, offset, offset+length, offset, offset+length, "block");
                blocks.add(blockName);
            }
        };
       
        if (scope == null || scope.getLanguageToolkit() == null) {
            return null;
        }
       
        engine.search(ITwigModelElement.BLOCK, null, null, 0, 0, 200, SearchFor.REFERENCES, null, scope, requestor, null);
        return blocks;
    }
View Full Code Here

      return;
    }
    CompletionRequestor requestor = abstractContext
        .getCompletionRequestor();

    MatchRule matchRule = MatchRule.PREFIX;
    if (requestor.isContextInformationMode()) {
      matchRule = MatchRule.EXACT;
    }

    IField[] fields = null;
View Full Code Here

    String prefix = abstractContext.getPrefix();
    if (prefix.startsWith("$")) { //$NON-NLS-1$
      return;
    }

    MatchRule matchRule = MatchRule.PREFIX;
    if (requestor.isContextInformationMode()) {
      matchRule = MatchRule.EXACT;
    }

    ISourceModule sourceModule = abstractContext.getSourceModule();
View Full Code Here

    String prefix = abstractContext.getPrefix();
    if (prefix.startsWith("$")) { //$NON-NLS-1$
      return;
    }

    MatchRule matchRule = MatchRule.PREFIX;
    if (requestor.isContextInformationMode()) {
      matchRule = MatchRule.EXACT;
    }
    IDLTKSearchScope scope = createSearchScope();
View Full Code Here

          extraObject);
    }
    // report global variables in special globals array:
    else if (arrayVarName.equals("$GLOBALS")) { // NON-NLS-1 //$NON-NLS-1$

      MatchRule matchRule = MatchRule.PREFIX;
      if (requestor.isContextInformationMode()) {
        matchRule = MatchRule.EXACT;
      }
      IDLTKSearchScope scope = createSearchScope();
      IField[] elements = PhpModelAccess.getDefault().findFields(
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.