Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Implementing the Search operation
Implementing the Search operation [message #670078] Thu, 12 May 2011 15:11 Go to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hello everyone,

I'm curious about how the "Find References" operation in Eclipse works. Or, how the search operations works (I think it has a similar implementation).

What I want to do is to display some results in a view like the Search operation of Eclipse does (search results). To be more specific: I can make an OCL query in an editor I programmed, which returns some objects (OCL is not important here, just think about a process where you filter out some elements from a set of elements). For now, I can simply print them out in the console. I want to list them in a view, like the normal Search operation does (maybe I can use some extension point from there). When the user clicks on an entry, the reference to that element should be marked/selected in an editor.

Could you please give me some hints where to start? This explanation is not really helpful...

Thank you in advance.

Darie
Re: Implementing the Search operation [message #673363 is a reply to message #670078] Mon, 23 May 2011 11:13 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 12.05.2011 17:11, Darie wrote:
> Hello everyone,
> I'm curious about how the "Find References" operation in
> Eclipse works. Or, how the search operations works (I think
> it has a similar implementation).
>
> What I want to do is to display some results in a view like
> the Search operation of Eclipse does (search results). To
> be more specific: I can make an OCL query in an editor I
> programmed, which returns some objects (OCL is not
> important here, just think about a process where you filter
> out some elements from a set of elements). For now, I can
> simply print them out in the console. I want to list them
> in a view, like the normal Search operation does (maybe I
> can use some extension point from there). When the user
> clicks on an entry, the reference to that element should be
> marked/selected in an editor.
>
> Could you please give me some hints where to start?
> http://wiki.eclipse.org/FAQ_How_do_I_implement_a_search_operation%3F
> explanation is not really helpful...
Take a look at the 'Search support' section in the 'Platform Plug-in
Developer Guide'.

Dani
>
> Thank you in advance.
>
> Darie
Re: Implementing the Search operation [message #688368 is a reply to message #673363] Fri, 24 June 2011 14:29 Go to previous messageGo to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hi Dani,

thank you for your time & sorry for my late reply. I didn't get any new post notification per email Sad

Anyway, I looked where you advised me and also searched the internet for other custom implementations of the search operation. Looking into the Search support section of the dev guide was not very helpful, because they only say there what classes you need and which classes to extend. No implementation details/hints are given. I also found this implementation (Java Search), but the problem is that my implementation is just about displaying the results - all examples treat the whole problem - the search page, the query, the search itself and the results being displayed. They build one on another (query objects are being passed from class to class) and I could not find the spot where my implementation goes the same way as the others. Here's another link I found, unfortunately there's the same problem. Maybe you are more experienced and can just give me a hint what to keep from that whole structure and what I don't need from there.

But please let me detail a little bit my thoughts. As I previously said, I can make an OCL query in one of my editors. The Object Constraint Language (OCL) is irrelevant here, what matters is that the actual search is already implemented by the OCL language. After doing a query with OCL, I automatically get an object of type Collection<EObject>. So the search itself is done for me automatically.

Having a collection of EObjects, the only thing I want to do with them is simply display them in a Search View of Eclipse (tree-like). I don't want to search anything, I don't have any search queries to evaluate etc. Just imagine you have a list of objects and want to create out of this list a Search View which displays each element from the list in a tree, like everyone's costumed when performing a classic file search in Eclipse - instead of programming yourself an editor part where you display the list elements.

Let's just first stick to this question, other details are not so important right now for this part of my implementation. If you can give me a hint where to start, I would be really greatful.

Thanks in advance.

[Updated on: Fri, 24 June 2011 14:31]

Report message to a moderator

Re: Implementing the Search operation [message #688414 is a reply to message #688368] Fri, 24 June 2011 16:18 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 6/24/2011 7:59 PM, Darie wrote:
> but the problem is that my implementation
> is just about displaying the results
What do you mean by this? Are you able to display the results in the
search view? But they do not look good ?
Re: Implementing the Search operation [message #689763 is a reply to message #670078] Tue, 28 June 2011 09:55 Go to previous messageGo to next message
Darie Moldovan is currently offline Darie MoldovanFriend
Messages: 67
Registered: November 2010
Location: Darmstadt, Germany
Member
Hi Azad,

thank you for the reply.

The only thing I managed to do is to open the Search View programatically:

NewSearchUI.activateSearchResultView();
ISearchResultViewPart viewPart = NewSearchUI.getSearchResultView();


Now, I want to start populating the search view with my own data, not with a standard search result (which is often a class extending AbstractTextSearchResult and implementing ISearchResult).

I tried ignoring the fact that I don't have any search results the way that they are returned when you actually search something and tried to add my own objects in the search view 'by hand'. I just want to display the elements of a Collection<EObject> in the search view.

Having opened the search view programatically, how can I populate it with values? Suppose we use the tree representation in the search view.

Thanks in advance.

Darie

[Updated on: Tue, 28 June 2011 09:56]

Report message to a moderator

Re: Implementing the Search operation [message #695797 is a reply to message #689763] Tue, 12 July 2011 14:00 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 28.06.2011 11:55, Darie wrote:
> Hi Azad,
>
> thank you for the reply.
>
> The only thing I managed to do is to open the Search View
> programatically:
>
> NewSearchUI.activateSearchResultView();
> ISearchResultViewPart viewPart = NewSearchUI.getSearchResultView();
>
> Now, I want to start populating the search view with my own data, not
> with a standard search result (which is often a class extending
> AbstractTextSearchResult and implementing ISearchResult).
Well, it is the *Search* view after all and there to display the search
results and not some random data.

Dani
>
> I tried ignoring the fact that I don't have any search results the way
> that they are returned when you actually search something and tried to
> add my own objects in the search view. I just want to display the
> elements of a Collection<EObject> in the search view.
>
> Having opened the search view programatically, how can I populate it
> with values? Suppose we use the tree representation in the search view.
>
> Thanks in advance.
>
> Darie
Previous Topic:Get IPackageFragments of an IPackageFragment
Next Topic:Calling my jdt plugin from a class
Goto Forum:
  


Current Time: Tue Mar 19 11:06:49 GMT 2024

Powered by FUDForum. Page generated in 0.01963 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top