Bug 210446 - Patch for enabling C/C++ Search to expand and select the first match
Summary: Patch for enabling C/C++ Search to expand and select the first match
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 5.0   Edit
Assignee: Markus Schorn CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-11-20 15:49 EST by Stanley Law CLA
Modified: 2009-01-09 17:06 EST (History)
0 users

See Also:


Attachments
patch file (5.79 KB, patch)
2007-11-20 15:49 EST, Stanley Law CLA
no flags Details | Diff
patch file (5.96 KB, patch)
2007-11-27 18:39 EST, Stanley Law CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stanley Law CLA 2007-11-20 15:49:38 EST
Created attachment 83359 [details]
patch file

Build ID: 200711200801

Steps To Reproduce:
1.Create a Hello World C++ Project.
2.Ctrl-H => C/C++ Search tab => fill in "main" for Search String => Hit Search.
3.Search view does not select the first match and expand like File and Java Search does.


More information:
User would like to see C/C++ tab as default upon Ctrl-H, should 
the last C/C++ search returns any matches.

Following changes enable selecting the first match to
guide Eclipse toward search tab of appropriate context:

-PDOMSearchTreeContentProvider changes mimic what JDT 
does for setting up search tree, including converting some
functions to synchronized.
-Added PDOMSearchElementAdapterFactory, PDOMSearchElement 
now extends PlatformObject. These allow computeSource() 
in org.eclipse.search.internal.ui.SearchPageDescriptor 
to evaluate a score.
Comment 1 Stanley Law CLA 2007-11-27 18:39:52 EST
Created attachment 83914 [details]
patch file

A newer patch fixed some issues when search results are header files
Comment 2 Markus Schorn CLA 2007-12-10 08:41:16 EST
Thanks Stanley,
to fix the problem it is sufficient to remove the 'asyncExec' blocks, which is safe because the search-API guarantees to call the methods in the UI-thread. For the same reason it is not necessary to add synchronized sections.

To make the score-evaluation work, I have implemented IAdaptable for the PDOMSearchElement directly and used the full-path there, because it is more efficient.

Fixed in 5.0 > 20071210.