Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-search-dev] NewSearchUI - results not showing


You should not have to call setViewPart(), showSearchResult(), etc. manually.

Have you tried simplifying your code to e.g. the following?

      BeanReferenceSearcher collator = new BeanReferenceSearcher(_fqn);
     NewSearchUI.activateSearchResultView();
     IRunnableContext ctx = new ProgressMonitorDialog(new Shell());
     NewSearchUI.runQueryInForeground(ctx, collator);

Another possible problem source I could think of is the method getSearchResult() of your ISearchQuery (BeanReferenceSearcher). This method must return the same object if called multiple times (see e.g. NLSSearchQuery from org.eclipse.jdt.ui). You have to create the object on the first request, and then add matches to it as your search engine encounters them (e.g. via AbstractTextSearchResult#addMatch()).

HTH,
Markus


David Watkins <David_Watkins@xxxxxxxx>
Sent by: platform-search-dev-admin@xxxxxxxxxxx

08/24/2004 05:39 PM

Please respond to
platform-search-dev@xxxxxxxxxxx

To
platform-search-dev@xxxxxxxxxxx
cc
Subject
[platform-search-dev] NewSearchUI - results not showing









Hi,
I've been having problems getting search matches displayed
using the NewSearchUI. I've got a workaround but it relies
on an .internal. class so I'm not happy with it!

In a nutshell I'm adding a context menu entry for Java Elements
to allow for reference searches in an xml file (Spring).
Using the debugger I can see the search routine is returning
the correct matches but they don't get displayed unless you do
the search and then display it from the search history.
Performing a new search has a similar problem.

I'm sure I'm missing something but have read and re-read
the docs and can't see what.

Anyway the hack I've come up with is the one immediately after
the TODO line.

---FindReferencesActionDelegate::run()----
     ....
     BeanReferenceSearcher collator = new BeanReferenceSearcher(_fqn);
     NewSearchUI.activateSearchResultView();
     IRunnableContext ctx = new ProgressMonitorDialog(new Shell());
     NewSearchUI.runQueryInForeground(ctx, collator);
     AbstractTextSearchResult matches = collator.getMatches();
     NewSearchUI.activateSearchResultView();
     ISearchResultViewPart part = NewSearchUI.getSearchResultView();
     BeanSearchResultPage myPage = new BeanSearchResultPage();
     myPage.setViewPart(part);

     //TODO: work out how to do this next line without relying on internal
     ((SearchView) part).showSearchResult(matches);  // <- hack!

     ISearchResultPage page = part.getActivePage();
     NewSearchUI.activateSearchResultView();
     ...
-----------------

I've registered the BeanSearchResultPage to the ext-point
org.eclipse.search.searchResultViewPages.  Is there any other
step I need to take before invoking the NewUISearch?

I'm using Eclipse 3.0 on Sun JDK 1.4.2 on Win2000.

Any ideas/pointers would be gratefully appreciated.

Regards,
Dave Watkins

_______________________________________________
platform-search-dev mailing list
platform-search-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-search-dev


Back to the top