Bug 187602 - Provide extension point for specifying duplicate detectors
Summary: Provide extension point for specifying duplicate detectors
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: 3.0   Edit
Assignee: meghan CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-05-17 12:53 EDT by Gail Murphy CLA
Modified: 2007-10-26 14:01 EDT (History)
3 users (show)

See Also:


Attachments
mylar/context/zip (3.36 KB, application/octet-stream)
2007-05-17 15:26 EDT, Mik Kersten CLA
no flags Details
extension point for duplicate detectors (57.36 KB, patch)
2007-06-07 13:16 EDT, meghan CLA
no flags Details | Diff
mylar/context/zip (60.40 KB, application/octet-stream)
2007-06-07 13:16 EDT, meghan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gail Murphy CLA 2007-05-17 12:53:31 EDT
It would be helpful to have an extension point for specifying a duplicate detector to use for a particular repository type and/or project. We have some experimental duplicate detection software we'd like to make available but its awkward to contribute without the extension point.

We can work on contributing the extension point.
Comment 1 Eugene Kuleshov CLA 2007-05-17 13:29:46 EDT
It seem like a great idea. I also want to remind that current search for duplicates don't work too well...
Comment 2 Mik Kersten CLA 2007-05-17 14:59:50 EDT
Nope, the current search is way too fragile (bug 161877) and this should make it easier for someone else to contribute better heuristics.  If we end up with multiple extensions (e.g. one for simple Java, another for Ruby, another for fancy NLS) we can provide UI for allowing the user to choose which one to use.  But the key thing is that we get such an extension point.

Gail: if you guys are able to contribute within the next two weeks we can get this into 2.0.
Comment 3 Mik Kersten CLA 2007-05-17 15:25:57 EDT
One way to do this is to have plug-ins specify an AbstractDuplicateDetectionCollector class which would extend SearchHitCollector.  Another is to have an abstract class or interface that extends ISearchQuery with duplicate-detection specific stuff.  A good example of how to make an extension point of this sort is ..tasks.ui/schema/projectLinkProviders.exsd.  An implementation of the extension point could look like this:

<extenion point="org.eclipse.mylar.tasks.ui.duplicateDetectors>
   <detector 
   		id="org.eclipse.mylar.java.duplicateDetector.stackFrame"
   		class=".."
   		name="Naiive Java Stack Frame Duplicate Detector"
   		image="icons/javaStackTrace.gif"/>
</extensions>

For UI for allowing the user to select a duplicate detection the PDe validation on the Plug-ins tab of a Workbench runtime configuration is probably a good example.  It has the default "Validate Automatically Prior to Launching".  We could have a similar drop down in the NewBugzillaTaskEditor (eventually this should be generic) and it could simply remember the last duplicate detector that was used.
Comment 4 Mik Kersten CLA 2007-05-17 15:26:47 EDT
Here is a context to get you started.
Comment 5 Mik Kersten CLA 2007-05-17 15:26:51 EDT
Created attachment 67716 [details]
mylar/context/zip
Comment 6 Eugene Kuleshov CLA 2007-05-17 15:43:33 EDT
BTW, I think PDE's validate drop down is one of the worst UI pieces. It may look cool, but it is totally counter intuitive to have toolbar-like icon inside of dialog. Not to mention that their UI can't be accessed without mouse.
Comment 7 meghan CLA 2007-05-17 17:12:40 EDT
I will work on this, but I'm not able to assign it to myself - could someone else assign it to me?
Comment 8 Mik Kersten CLA 2007-05-17 20:29:08 EDT
 (In reply to comment #6)
> BTW, I think PDE's validate drop down is one of the worst UI pieces. It may look
> cool, but it is totally counter intuitive to have toolbar-like icon inside of
> dialog. Not to mention that their UI can't be accessed without mouse.

I agree.  I was using it as an example of a drop-down button showing up in a page, but neglected to mention that the end result of their UI is way worse than it used to be as a single button.  I still think that we can take the button approach, but if not perhaps there needs to be a combo where you select the detector and a "Search for Duplicates" button.
Comment 9 Eugene Kuleshov CLA 2007-05-17 21:45:09 EDT
I wonder if detector selection should be in the repository configuration...
Comment 10 Mik Kersten CLA 2007-05-18 14:25:40 EDT
It seems like we need to support both generic (e.g. Java heuristics) and connector specific (e.g. require executing special WS calls) duplicate detection.  The easiest way to do this is probably to add the following optional attribute to the extension point:

	connectorKind="bugzilla"
	
Then if the kind were specified, the task editor would only show that detector if it was applicable.
Comment 11 meghan CLA 2007-06-06 01:16:34 EDT
what's the deadline to get this into 2.0M3?  I keep thinking it's almost done and then finding something that I haven't quite done right...
Comment 12 Mik Kersten CLA 2007-06-06 14:21:02 EDT
The next release is RC1.  The deadline for getting it in is next Friday.  Which means that we should be iterating on a reasonable version of it early next week.
Comment 13 meghan CLA 2007-06-07 13:16:57 EDT
Created attachment 70530 [details]
extension point for duplicate detectors

This patch provides an extension point for duplicate detectors and converted the Stack Trace duplicate detector to use this extension point.

I will create some documentation for people who wish to use this extension point with their own duplicate detectors.
Comment 14 meghan CLA 2007-06-07 13:16:59 EDT
Created attachment 70531 [details]
mylar/context/zip
Comment 15 meghan CLA 2007-06-07 13:17:40 EDT
I think this patch will merge with all the Task changes that have just gone in.  It would be great if it could get in before the name change...
Comment 16 Mik Kersten CLA 2007-06-07 13:38:06 EDT
Patch applied.  I will review this more closely after the rename.
Comment 17 Mik Kersten CLA 2007-06-07 14:45:47 EDT
Meghan: I had to do some additional merging manually, you'll need to review your code after the rename is done.
Comment 18 meghan CLA 2007-06-07 14:58:50 EDT
ok, thanks Mik. I will.
Comment 19 Mik Kersten CLA 2007-06-12 00:49:03 EDT
Meghan: note that I moved your extension point to ..mylyn.bugzilla.ide.
Comment 20 Robert Elves CLA 2007-06-12 21:51:20 EDT
I updated the extension schema to require a java element vs string so that you must declare a class that extends AbstractDuplicateDetector.
Comment 21 meghan CLA 2007-06-13 02:15:58 EDT
thanks Rob, that is definitely better.
Comment 22 Mik Kersten CLA 2007-06-13 17:27:31 EDT
We still need to fix the layout and make sure that the duplicate detection buttons/toggle is not shown if there is no duplicate detector installed.
Comment 23 Shawn Minto CLA 2007-06-15 13:06:27 EDT
Upon creating a new task that is not a bugzilla task, the stack trace duplicate detector is in the list of detectors.  This seems to be the case since all of the duplicate detectors are added to the editor and there is no notion of the repository kind that they support.  Maybe a method like canSearchDuplicates(String repositoryKind) could be added so that we ensure that the correct duplicate detectors are used.
Comment 24 Gail Murphy CLA 2007-06-15 13:08:47 EDT
I'm working on a related issue this morning and can try to tackle this one too.
Comment 25 Eugene Kuleshov CLA 2007-06-17 20:02:04 EDT
BTW, please watch out for the borders on the forms.
Comment 26 Mik Kersten CLA 2007-06-17 20:53:44 EDT
Yup, the border stuff is tricky.

Gail: don't worry about this, when Rob reviews he can make sure it works properly across platforms and themes.
Comment 27 meghan CLA 2007-06-20 02:37:45 EDT
 (In reply to comment #23)
> Upon creating a new task that is not a bugzilla task, the stack trace duplicate
> detector is in the list of detectors.  This seems to be the case since all of
> the duplicate detectors are added to the editor and there is no notion of the
> repository kind that they support.  Maybe a method like
> canSearchDuplicates(String repositoryKind) could be added so that we ensure that
> the correct duplicate detectors are used.

The default behaviour is that every duplicate detector is shown for every new task.  I don't know much about the other connectors, so let me know if this should be changed. There is an optional 'kind' attribute that can be specified in the xml for the duplicate detector, and then each subclass of AbstractNewRepositoryTaskEditor can override the getDuplicateSearchCollectorsList() method and return a list that only includes the duplicate detectors that are appropriate for the repository (by checking the 'kind' attribute).  Should I add that to the Trac and Jira connectors so that the Stack Trace duplicate detector only displays for the new Bugzilla tasks?
Comment 28 meghan CLA 2007-06-20 02:43:37 EDT
 (In reply to comment #25)
> BTW, please watch out for the borders on the forms.

Eugene - could you elaborate? I'm not sure what you mean.
Comment 29 meghan CLA 2007-06-20 02:44:54 EDT
 (In reply to comment #22)
> We still need to fix the layout and make sure that the duplicate detection
> buttons/toggle is not shown if there is no duplicate detector installed.

the 'Search for Duplicates' button and combo box should only be displayed if at least one connector is installed.

what do we need to do for the layout?
Comment 30 Gail Murphy CLA 2007-06-20 11:14:28 EDT
I think the patch on bug 156061 will show just a label if there is no duplicate detector registered. 
I think it is now set up to only show the stack trace for Bugzilla but this still needs to be verified.
Comment 31 Mik Kersten CLA 2007-06-26 11:30:48 EDT
Further changes to this need to wait post 2.0.  

Meghan, Gail: could you summarize if there is anything left here that you need?
Comment 32 Eugene Kuleshov CLA 2007-06-27 10:49:59 EDT
Please note that current support been only added to Bugzilla editor, so we lose stack trace detector for jira and trac

I wonder if the following method should be pushed to the super class.

	protected Set<AbstractDuplicateDetector> getDuplicateSearchCollectorsList() {
		return TasksUiPlugin.getDefault().getDuplicateSearchCollectorsList();
	}

Anyways, that change need to be included into the porting guide, because without adding this getDuplicateSearchCollectorsList(), detectors created by connectors aren't being picked up.
Comment 33 Eugene Kuleshov CLA 2007-06-27 17:14:54 EDT
Apparently, current duplicate detector extension point and corresponding api is missing repository type. So, StackTraceDuplicateDetector for bugzilla should use "bugzilla" kind value and connector-specific editors should filter list of detectors according to the kind.
Comment 34 Mik Kersten CLA 2007-10-26 14:01:06 EDT
Core work here is done.  Additional needs can go on new bugs.