Bug 291770 - [api] allow connectors to advise on populating People content assist popup
Summary: [api] allow connectors to advise on populating People content assist popup
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 2 votes (vote)
Target Milestone: 3.5   Edit
Assignee: Sam Davis CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
: 334039 (view as bug list)
Depends on:
Blocks: 152553 291795
  Show dependency tree
 
Reported: 2009-10-08 11:16 EDT by maarten meijer CLA
Modified: 2011-01-13 23:31 EST (History)
5 users (show)

See Also:


Attachments
patch (3.60 KB, patch)
2011-01-11 18:28 EST, Sam Davis CLA
steffen.pingel: iplog+
Details | Diff
mylyn/context/zip (2.15 KB, application/octet-stream)
2011-01-11 19:15 EST, Steffen Pingel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description maarten meijer CLA 2009-10-08 11:16:35 EDT
I working on some issues raised by users beta version of Industrial SQL Connector.
See bug 184532: [connector] Generic SQL connector

The people fields in the task editor have content assist, but that is not prefilled. So my question was 
How and where can I populate the names of the people to which a bug may be assigned?

Here is what I found after some searching:
- the proposals are prepared in org.eclipse.mylyn.internal.tasks.ui.PersonProposalProvider
- the mechanism is that it wil loop over all LOADED tasks that share the same repository URL and add the owner of that task
- there is no code to add commenters or reporters, or to query the repository, or to intervene and advise in this process.
The code is heavily commented with FIXME reimplement for 3.3

In my case I can just do an SQL query to the database to provide a list of people. Either a SELECT DISTINCT on the history or a SELECT on a special table containing current bug owners.
Content assist may be different for Assigned To, CC, QA contact or other person fields. 
Content assist may also be different for based on specific Task properties, such as product,component, platform, or severity...

So I propose a method to be added to the repository API called SortedSet<String> advisePersonProposals(TaskAttribute attribute, ITask task, TaskData data, SortedSet<String> proposal);
that in turn will call a method in the connector SortedSet<String> advisePersonProposals(TaskRepository repository, TaskAttribute attribute, ITask task, TaskData data, SortedSet<String> proposal); The default list will contain the current task owner.
The default will either return the unchanged list, or loop through loaded tasks and add the owners. A connector writer can then override and make it more specific to its repository kind.

If this sounds like a good idea I would be willing to contribute such a patch for the tasks core.
Comment 1 Steffen Pingel CLA 2009-12-01 22:11:19 EST
That sounds like a good idea to me. We have discussed a cache for repository person objects that is populated by connectors for a while now but haven't come up with a good API, yet. 

Maarten, how do you imagine supporting asynchronous behavior in this API assuming that the call to the database could take a while?
Comment 2 Steffen Pingel CLA 2011-01-11 17:28:23 EST
*** Bug 334039 has been marked as a duplicate of this bug. ***
Comment 3 Sam Davis CLA 2011-01-11 18:28:27 EST
Created attachment 186583 [details]
patch
Comment 4 Steffen Pingel CLA 2011-01-11 19:15:09 EST
Great patch! I have applied it to head.

Connectors that wish to provide a list of proposals for the people content assist may either set options on the corresponding task attribute or override TaskAttributeMapper.getOptions() to return a dynamically generated list of proposals. The value of the returned map is used for the presentation in the content assist UI and the key is stored in the task attribute value.
Comment 5 Steffen Pingel CLA 2011-01-11 19:15:11 EST
Created attachment 186587 [details]
mylyn/context/zip