Bug 187225 - Rework opening of editors from Search view
Summary: Rework opening of editors from Search view
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Search (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.6 M5   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2007-05-16 06:29 EDT by Dani Megert CLA
Modified: 2010-01-25 09:48 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2007-05-16 06:29:50 EDT
I20070516-0010.

The current approach requires clients to duplicate the rather complicated code of the org.eclipse.search.internal.ui.text.EditorOpener. We should either make this class API or provide an easier mechanism for clients.

Internal note: while the Search opener throw the PartInitException all the way up it is catched in the JavaSearchEditorOpener.
Comment 1 Min Idzelis CLA 2009-12-08 13:29:54 EST
I would like seeing EditorOpener made into API.
Comment 2 Dani Megert CLA 2009-12-09 04:45:14 EST
>I would like seeing EditorOpener made into API.
What's your exact use case?
Comment 3 Min Idzelis CLA 2009-12-09 09:36:21 EST
(In reply to comment #2)
> >I would like seeing EditorOpener made into API.
> What's your exact use case?

I am implementing a new type of search. I have subclassed AbstractTextSearchViewPage. I would like to implement the method showMatch(). If this is not implemented, the start/next buttons do not do anything. 

I saw that EditorOpener does a lot of this stuff for me. Currently, I'm referencing this internal API, but I would like to make it real API. 

Alternatively, you don't need to make EditorOpener real API. 

What if Match implemented IAdaptable? The AbstractTextSearchViewPage implementation of showMatch could ask for an IResource adapter from the Match, and then use (an internal field holding) the EditorOpener to open the resource. It really has all the other information it needs (offset/length/activate) - the only think missing is the IResource. 

--
a little off topic...
--
The EditorOpener could also be used via a double click listener on the results viewer. Right now I have to install my own. A default one could have been provided via AbstractTextSearchViewPage.
Comment 4 Dani Megert CLA 2010-01-20 12:14:08 EST
Min, would it be enough if we added the following two methods:

AbstractTextSearchViewPage.open(IWorkbenchPage, IFile, boolean)
AbstractTextSearchViewPage.openAndSelect(IWorkbenchPage, IFile, int, int, boolean)

?
Comment 5 Dani Megert CLA 2010-01-22 10:58:19 EST
ping.
Comment 6 Dani Megert CLA 2010-01-25 07:08:51 EST
Added API in HEAD but did not rework all the existing code (no time and no immediate benefit).

Min, please file a new bug report if that's enough for you.

Fixed in HEAD.
Available in builds >= I20100125-1300.
Comment 7 Dani Megert CLA 2010-01-25 07:11:09 EST
.
Comment 8 Min Idzelis CLA 2010-01-25 09:48:44 EST
I reviewed the code in HEAD. Thank you for resolving this defect. The new API works for me.