This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 242969 - make task editor find model based
Summary: make task editor find model based
Status: RESOLVED DUPLICATE of bug 134165
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: dev   Edit
Hardware: PC All
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 134165 248369
  Show dependency tree
 
Reported: 2008-08-02 20:04 EDT by Steffen Pingel CLA
Modified: 2013-10-08 23:43 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2008-08-02 20:04:52 EDT
The current task editor find implementation in the sandbox creates source viewer controls as it searches for text. To ensure good performance it should operate on the data model rather than the user interface and only create description/comment viewers as needed.
Comment 1 Jingwen 'Owen' Ou CLA 2008-08-04 23:33:20 EDT
could u give some hints on how to initiate the implementation?

I have two ideas after some lookups (operating find on the data model):

1) add the find concerns to AbstractAttributeEditor (e.g. AbstractAttributeEditor.findInAttribute(..)) which has TaskAttribute and we start by matching TaskAttribute.getValue() with expected regular expression.

2) add the concerns to TaskAttribute (e.g. TaskAttribute.findByKeywords(..)).

One of the drawback of searching the data model is that it might be difficult to match the location in the model with the location in the widget (e.g. we need to highlight the find results in the source viewer). 

Any thoughts? You might have better ideas than I do :)
Comment 2 Steffen Pingel CLA 2008-08-05 00:48:33 EDT
To scope this first cut of a model-based search implementation it should be sufficient to limit it to the task editor and worry about a more generalized task search later (bug  165391, bug 191522). Could you list the requirements for a search API in more detail? Taking the Firefox search as an example I can come up with this:

 List<SearchResult> findAll(SearchCriteria)  
 SearchResult findNext(SearchCriteria, SearchResult)
 SearchResult findPrevious(SearchCriteria, SearchResult)
 void highlight(List<SearchResult>)

SearchCriteria could encapsulate the search mode, e.g. if it is case sensitive, regular expression based etc. It would be great if you could take a look at the existing APIs in Eclipse, e.g. for text editor search, to get an idea how to design this. 

Using attribute editors could work well since they provide a link between the data model and the user interface and can implement highlighting properly. I don't think a list of attribute editors is currently available in the API but the attribute editor factory would be a good a place to manage these. This might require changes to the part implementations to create attribute editors more eagerly. This should be okay since they are designed to be lightweight as long as the controls are not realized.
Comment 3 Jingwen 'Owen' Ou CLA 2008-08-06 03:04:49 EDT
I follow up with more descriptions (fix me if anything is inappropriate):

* AbstractAttributeEditor
	- void highlight(List<SearchResult>)
	- IRegion modelRange2WidgetRange(IRegion)
	- IModelFindManager getModelFindManager()

* IModleFindManager [using AbstractAttributeEditor.getModelFindManager()]
	- List<SearchResult> findAll(SearchCriteria)  
 	- SearchResult findNext(SearchCriteria, SearchResult)
 	- SearchResult findPrevious(SearchCriteria, SearchResult)

* SearchResult
	- IRegion getRegion()
	- String getFindString()

* SearchCriteria
	- SearchCriteria (startModelOffset, findString, isForwardSearch, isCaseSensitive, isWholeWord, isRegExSearch) - we might not need that much options
	- getter & setter
	
The only thing I am not sure is how to highlight the results in a proper Text/TextViewer control, we might also need to a setText(..) method in AbstractAttributeEditor.
	
Comment 4 Jingwen 'Owen' Ou CLA 2008-08-15 19:46:56 EDT
I did some initial implementations. The following problems are observed:

1) The UI & and model cannot be easily connected, e.g.  AbstractAttributeEditor knows nothing of "part", its difficult to only create description/comment viewers as needed.
2) AbstractAttributeEditors are lazily created as a widget, so its impossible to find the model before building the widget, that means we have to create the widget first.

My conclusion is AbstractAttributeEditor might not be a good place to host the "find"
Comment 5 Steffen Pingel CLA 2008-08-15 20:20:10 EDT
Thanks for summarizing your findings. I agree that this will require further work on the framework side such as a mapping between the data model and the attribute editors and ways to programmatically construct and display editor controls. There is some overlap with other bugs such as bug 242430 (editor validation) or bug 166123 (navigate to comment) as well which should be considered when designing a generic solution.

An initial implementation prototype could be specific to the comment part to get a better sense for the abstraction. I'll lower the priority for now. I think it's best to focus on completing the other open tasks first and then we can revisit this task.
Comment 6 Jingwen 'Owen' Ou CLA 2008-10-05 15:08:55 EDT
(In reply to comment #5)
> Thanks for summarizing your findings. I agree that this will require further
> work on the framework side such as a mapping between the data model and the
> attribute editors and ways to programmatically construct and display editor
> controls. There is some overlap with other bugs such as bug 242430 (editor
> validation) or bug 166123 (navigate to comment) as well which should be
> considered when designing a generic solution.
> 
> An initial implementation prototype could be specific to the comment part to
> get a better sense for the abstraction. I'll lower the priority for now. I
> think it's best to focus on completing the other open tasks first and then we
> can revisit this task.
> 

Can start iterating this bug?

Comment 7 Steffen Pingel CLA 2008-10-06 13:16:11 EDT
Sure. Hack away :). Note, that I'll probably move the comment grouping from the sandbox to main sometime this week.
Comment 8 Sam Davis CLA 2013-10-08 23:43:51 EDT
We ended up treating this and its parent as one task.

*** This bug has been marked as a duplicate of bug 134165 ***