Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 381191

Summary: Global search: clicking on a hit file should open editor with find slide out.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: ClientAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Mike_Wilson, Silenio_Quarti, susan
Version: 0.4   
Target Milestone: 0.5 RC1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 381631    

Description libing wang CLA 2012-05-31 09:18:09 EDT
McQ mentioned this one day when we talked about the replace page.
When he hits a file in the result page the editor should open with the first matching line highlighted.
We already did this on the detail rows under a file. The trick is that before you expand a file we are not doing "in file search" for the matching lines. Now we have to do the "in file search" if the file is never expanded when it is clicked.

Actually I think a better approach is to open the editor by asking it to pup up the find box and put the search string in it. That will be cool.
Comment 1 libing wang CLA 2012-05-31 10:25:48 EDT
I like the way in the "get plugin" page. When you click on "install", it brings you to the setting page with params like below:

/settings/settings.html#,category=plugins,installPlugin=http://mamacdon.github.com/orion-codemirror/codeMirrorPlugin.html

So when I open editor if  I can use URL like :
/edit/edit.html#/file/g/local/edit/setup.js,line=45,find=FOO
where the second param will trigger the find command in editor and pops the slides out.

I think if we can do this, our global search and local find will integrate seamlessly. 
Susan, any suggestions?
Comment 2 Susan McCourt CLA 2012-05-31 11:45:55 EDT
(In reply to comment #1)
> I like the way in the "get plugin" page. When you click on "install", it brings
> you to the setting page with params like below:
> 
> /settings/settings.html#,category=plugins,installPlugin=http://mamacdon.github.com/orion-codemirror/codeMirrorPlugin.html
> 
> So when I open editor if  I can use URL like :
> /edit/edit.html#/file/g/local/edit/setup.js,line=45,find=FOO
> where the second param will trigger the find command in editor and pops the
> slides out.
> 
> I think if we can do this, our global search and local find will integrate
> seamlessly. 
> Susan, any suggestions?

I was thinking the same think in bug 334196
Comment 3 Susan McCourt CLA 2012-05-31 11:48:32 EDT
I think we should be able to use the command url binding for this as you suggest.  For me, the ideal behavior is that the find/replace is opened and the file is positioned and token highlighted at the first match.  It may "just work" by making a URL binding for find in the editor and then invoking that URL, I'm not sure though.
Comment 4 libing wang CLA 2012-06-04 13:24:02 EDT
fixed with http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=af20fe23c362d5265ad3667efce986a7c94c40e8.

Now if you click on a file the command URL binding pops up the find&replace slide-out. It finds and highlight the first hit from line 1.
If you click on a match it finds and highlight the first hit from the matching line.

Currently the command URL binding does not support multiple parameters. Nor does it support the order of multiple commands.

So for now I am using "find=foo@@line123" format in order to open the slide out and find foo from line 123.

Talked to Susan and I will open a new bug for supporting multiple parameters and the order of multiple command URL binding.
Will refactor my code once it is fixed.
Comment 5 libing wang CLA 2012-06-04 16:12:13 EDT
After fixed bug 381631, I changed the URL binding in the editor into some thing like:
,find=SEARCH_STRING@@replaceWith@@REPLACE_STRING@@atLine@@123

@@replaceWith@@ and @@atLine@@ are seperaters and optional.

Say, if you search on foo and replace it with bar from line 123 then the URL will be :
/edit/edit.html#/yourFIle.js,find=foo@@replaceWith@@bar@@atLine@@123