Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How do i make a search ?
How do i make a search ? [message #436164] Thu, 01 September 2005 04:12 Go to next message
Eclipse UserFriend
Originally posted by: gkurien.icope.com

Hi,

let me first say that I am new to RCP ..and i have been trying to do some
work on creating a Search...

I have a ViewPart in which i have a Tree Widget (TreeViewPart ). i want to
use the Search capability to search the Tree for a perticular TreeItem or
all instanceof a TreeItem with a perticular characteristics . Can u help
me how do i go about doing it.?

I tried using the extention org.eclipse.search.searchPages ..i know when
i click the search button it executes the boolean performAction() ....

i have used this code to open a query -----

myQuery query=new myQuery(container.getSelection());
NewSearchUI.runQueryInForeground( container.getRunnableContext(), query);
NewSearchUI.activateSearchResultView();

Now i have also extended both ISearchResult (mySearchResult) and a
ISearchResultPage (myresultPage)class ...

1) How do i go abt using the above two class ?
2) Do i create the instanceof the class ISearchResult in my ISearchQuery
(myQuery) class ?
3) if i do that ,how do get the instanceof the TreeViewPart in
ISearchQuery (myQuery())
3) Since i am not using a TreeViewer , i have implemented the
ISelectionProvider and ISelection and overided the method

public ISelection getSelection() { // overiding the method
ISelection.getSelection()
return this; // this the instance of TreeViewPart
}

thinking that i can get the instance of TreeViewPart from it when the
SearchPage.setContainer(ISearchPageContainer container) gives the
container and using the container.getSelection() to get the ISelection
which should be a TreeViewPart ......Unfortunately when i use the
getTree() (A method in TreeViewPart to get the Tree ) i dont get the Tree
instance ,but in my System.out.println(TreeViewPart.getTree()) i get the
following -------> Tree{*Wrong Thread*}

Why does it show a wrong thread info...I dont want to use the TreeViewer
coz i am not interested in a perticular ISelection object in a Tree .I
want to find all matching TreeItems and highlight its foreground

PLS help me out.....


if i dint make any sense from this pls can u guide me thru the entire
steps in deploying a serach using the org.eclipse.search.searchPages or if
there is another way around i am still willing to here it out...

I DONT WANT TO USE A SEARCH CAPABILITY IN A VIEWACTION TO GET MY THING
DONE
Re: How do i make a search ? [message #436226 is a reply to message #436164] Fri, 02 September 2005 00:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kent.generatescape.com

> or if there is another way around i am still willing to here it out...

I am not sure if you are using a TreeViewer, if so then you have a
treemodel.

This is what I do, I have a TreeViewer which has a model, for my model I use
the DefaultMutableTreeNode from Swing.

Then in my CotentProvider (this is a class required for the TreeViewer) I do
this:

public ArrayList searchTree(Pattern[] querys, NewCanalNode item)
{
ArrayList hits = new ArrayList();
Enumeration depthFirst = item.depthFirstEnumeration();

while (depthFirst.hasMoreElements())
{
NewCanalNode newnode = (NewCanalNode) depthFirst.nextElement();

if (newnode.getType() == CONSTANTS.TYPE_FEED_DESCRIPTION
|| newnode.getType() == CONSTANTS.TYPE_FEED)
{
for (int i = 0; i < querys.length; i++)
{
Matcher matcher = querys[i].matcher(newnode.getKey());

if (matcher.find())
{
hits.add(newnode);
continue;
}
}
}
}
return hits;

If you get your idea working, with searchPages, I would be very interested
to know your solution.

If you get no luck with searchpages, you might want to ask this on the swt
newsgroup.


"Genu George" <gkurien@icope.com> wrote in message
news:9429c7b5e124b9cd2d2344cf0690801d$1@www.eclipse.org...
> Hi,
>
> let me first say that I am new to RCP ..and i have been trying to do some
> work on creating a Search...
>
> I have a ViewPart in which i have a Tree Widget (TreeViewPart ). i want to
> use the Search capability to search the Tree for a perticular TreeItem or
> all instanceof a TreeItem with a perticular characteristics . Can u help
> me how do i go about doing it.?
> I tried using the extention org.eclipse.search.searchPages ..i know when
> i click the search button it executes the boolean performAction() ....
>
> i have used this code to open a query -----
>
> myQuery query=new myQuery(container.getSelection());
> NewSearchUI.runQueryInForeground( container.getRunnableContext(), query);
> NewSearchUI.activateSearchResultView();
>
> Now i have also extended both ISearchResult (mySearchResult) and a
> ISearchResultPage (myresultPage)class ...
>
> 1) How do i go abt using the above two class ? 2) Do i create the
> instanceof the class ISearchResult in my ISearchQuery (myQuery) class ?
> 3) if i do that ,how do get the instanceof the TreeViewPart in
> ISearchQuery (myQuery()) 3) Since i am not using a TreeViewer , i have
> implemented the ISelectionProvider and ISelection and overided the method
>
> public ISelection getSelection() { // overiding the method
> ISelection.getSelection() return this; // this the instance of
> TreeViewPart
> }
>
> thinking that i can get the instance of TreeViewPart from it when the
> SearchPage.setContainer(ISearchPageContainer container) gives the
> container and using the container.getSelection() to get the ISelection
> which should be a TreeViewPart ......Unfortunately when i use the
> getTree() (A method in TreeViewPart to get the Tree ) i dont get the Tree
> instance ,but in my System.out.println(TreeViewPart.getTree()) i get the
> following -------> Tree{*Wrong Thread*}
>
> Why does it show a wrong thread info...I dont want to use the TreeViewer
> coz i am not interested in a perticular ISelection object in a Tree .I
> want to find all matching TreeItems and highlight its foreground
>
> PLS help me out.....
>
>
> if i dint make any sense from this pls can u guide me thru the entire
> steps in deploying a serach using the org.eclipse.search.searchPages or if
> there is another way around i am still willing to here it out...
>
> I DONT WANT TO USE A SEARCH CAPABILITY IN A VIEWACTION TO GET MY THING
> DONE
Re: How do i make a search ? [message #436231 is a reply to message #436226] Fri, 02 September 2005 10:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gkurien.icope.com

hi,
Re: How do i make a search ? [message #436232 is a reply to message #436226] Fri, 02 September 2005 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gkurien.icope.com

hi,

thanx for the reply ..but it was not wat i was looking for..... i was
interested in using the eclipse extention point -->
"org.eclipse.search.searchPages" to do my Search ...do anyone have any
idea how to use this extention point ?

wat i have done till know is i have added the extentionpoint , but i dont
know how to display the SearchResult in the SearchPage...

pls help me out in this ....( and i am using SWT not Swings ...and i am
not using a TreeViewer just a Tree)
Re: How do i make a search ? [message #436239 is a reply to message #436232] Sat, 03 September 2005 01:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kent.generatescape.com

I really don't know how the search pages, work, as I have never used them,
but I presume they use lucent, so that means that the content of your tree
must somehow be indexed.

Like I said I am really not familiar with SearchPages, but I want to try and
help.

If there is not some function to pass the a tree into the search feauture
then you will have to iterate through your tree and either index what you
are interested in [ probably treeItem.getText() ], or forget indexing and
lucene and use what I have shown you but iterate through your tree.

This is how to iterate a tree without a model:
TreeItem[] siblings = item.getItems();

for (int i = 0; i < siblings.length; i++)
{
// then either use recursion or keep getting children until
there are none
}

DefaultMutableTreeNode can be used with SWT, that class is an abstraction
for a tree model and has nothing to do with Swing user interface. If you end
up using a tree model for your solution I recommend using
DefaultMutableTreeNode, however I would be interested if someone has a
better suggestion, as my tree is very big and end ups using a lot of memory.
If you do end up using a DefaultMutableTreeNode and a tree model you will be
able to at least use some of the iteration algorithmns (as per my example).



"Genu George" <gkurien@icope.com> wrote in message
news:3ab3352adbabca3771bce4efce3b36e0$1@www.eclipse.org...
> hi,
>
> thanx for the reply ..but it was not wat i was looking for..... i was
> interested in using the eclipse extention point -->
> "org.eclipse.search.searchPages" to do my Search ...do anyone have any
> idea how to use this extention point ?
>
> wat i have done till know is i have added the extentionpoint , but i dont
> know how to display the SearchResult in the SearchPage...
>
> pls help me out in this ....( and i am using SWT not Swings ...and i am
> not using a TreeViewer just a Tree)
>
>
>
Re: How do i make a search ? [message #436240 is a reply to message #436239] Sat, 03 September 2005 02:27 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: kent.generatescape.com

my other thoughts on this are that the built in search feature reads
documents that are locally stored on the hardrive. So I suppose you could
output the contents of your tree to xml, html or plain text. Have a look
here:

http://www.eclipsecon.org/2005/tutorials.php

Scroll down to tutorial #8 "Developing Eclipse Rich-Client Applications"

This explains how help works and a little about getting the search engine to
work with it. However this topic is very lightly covered. Also there is the
eclipse.platform user group they might be able to better help.



"kent" <kent@generatescape.com> wrote in message
news:dfaqsd$71k$1@news.eclipse.org...
>I really don't know how the search pages, work, as I have never used them,
>but I presume they use lucent, so that means that the content of your tree
>must somehow be indexed.
>
> Like I said I am really not familiar with SearchPages, but I want to try
> and help.
>
> If there is not some function to pass the a tree into the search feauture
> then you will have to iterate through your tree and either index what you
> are interested in [ probably treeItem.getText() ], or forget indexing and
> lucene and use what I have shown you but iterate through your tree.
>
> This is how to iterate a tree without a model:
> TreeItem[] siblings = item.getItems();
>
> for (int i = 0; i < siblings.length; i++)
> {
> // then either use recursion or keep getting children until
> there are none
> }
>
> DefaultMutableTreeNode can be used with SWT, that class is an abstraction
> for a tree model and has nothing to do with Swing user interface. If you
> end up using a tree model for your solution I recommend using
> DefaultMutableTreeNode, however I would be interested if someone has a
> better suggestion, as my tree is very big and end ups using a lot of
> memory. If you do end up using a DefaultMutableTreeNode and a tree model
> you will be able to at least use some of the iteration algorithmns (as per
> my example).
>
>
>
> "Genu George" <gkurien@icope.com> wrote in message
> news:3ab3352adbabca3771bce4efce3b36e0$1@www.eclipse.org...
>> hi,
>>
>> thanx for the reply ..but it was not wat i was looking for..... i was
>> interested in using the eclipse extention point -->
>> "org.eclipse.search.searchPages" to do my Search ...do anyone have
>> any idea how to use this extention point ?
>>
>> wat i have done till know is i have added the extentionpoint , but i dont
>> know how to display the SearchResult in the SearchPage...
>>
>> pls help me out in this ....( and i am using SWT not Swings ...and i am
>> not using a TreeViewer just a Tree)
>>
>>
>>
>
>
Re: How do i make a search ? [message #436277 is a reply to message #436240] Mon, 05 September 2005 13:08 Go to previous message
Eclipse UserFriend
Originally posted by: gkurien.icope.com

hi,
i think u r talking abt "searching for help" where each help contents
are stored as xml ... i am talking abt something similiar to searching a
text in a editor or selecting a project file from a package explorer (
..more similiar to selecting files from the project explorer with some
specific text )

u have been repeating on the fact that i have to do an iteration on the
Tree...but my problem is not that i cant iterate the Tree,infact i know
how to get the required item from the tree but i have done it without
using the SearchPage . Like u i am also not so familiar with using the
SearchPage extention and i just wanted to do it using that extention .
Previous Topic:Short cut key is not working in resource navigator view
Next Topic:Non Plugin Depeadant Project
Goto Forum:
  


Current Time: Thu Dec 26 18:52:39 GMT 2024

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

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

Back to the top