Bug 129061 - [Common Navigator] Request to support programmatic binding of drag adapter
Summary: [Common Navigator] Request to support programmatic binding of drag adapter
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Michael D. Elder CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks: 133127
  Show dependency tree
 
Reported: 2006-02-22 16:35 EST by Michael Valenta CLA
Modified: 2006-03-28 15:51 EST (History)
2 users (show)

See Also:


Attachments
Adds INavigatorDnDService.bindDragAssistant() (65.20 KB, patch)
2006-02-23 23:46 EST, Michael D. Elder CLA
no flags Details | Diff
The real patch (6.03 KB, patch)
2006-02-24 11:56 EST, Michael D. Elder CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Valenta CLA 2006-02-22 16:35:20 EST
We have a problem in the Team use of the Common Navigator is that each repository provider may define one or more viewers. It is not practical for each of the viewer definitions to define the complete set of drag assistants, especially considering that each model may have their own elements that can be dragged. It would simplify things if we could just programmatically bind drag assistants to a viewer. Then we could bind he resource drag assistant to all Team viewers for free. Currently, each provider with a viewer must add a dependency to the org.eclipse.ui.navigator.resources plugin and then add the dragAssistant binding to each viewer.
Comment 1 Michael D. Elder CLA 2006-02-22 17:15:29 EST
This should be easy to support. 

To handle this, the call would looks something like:

INavigatorContentService.getDnDService().bindDragAssistant(CommonDropAdapterAssistant)

Would the same capability be required for CommonDropAdapterAssistants? This would be trickier since the drop assistants are filtered using core expressions; and I'm not aware of a clean way to handle the creation of these expressions programmatically. Each drop assistant is currently associated with a particular navigatorContent extension; which means potentially the drop assistant could/would have to be programmatically bound to a particular extension. At first glance, I'm not sure this would be very clean ...
Comment 2 Michael Valenta CLA 2006-02-22 19:22:00 EST
Aren't the drop assistants associated with a navigatorContent extension already? If so, that is good enough since any model provider can define their own drop assistants. 

The problem with drag assistants is that they are conceptually linked to navigator content but must be associated with a viewer because that is what JFace/SWT requires. If I had the capability to register drag assistants programmatically, I would need to register the assistants for all models in case they ever showed content in the view. This is fine if the number is small but doesn't really scale. 

However, if the API is straightforward for you to add and you are comfortable putting it into 3.2, I can use it internally in 3.2 to get the resource transfer and then woryy about how to surface the API to Team clients in 3.3. This would free clients from putting the assistant in their viewers which would give me more flexibility as to how to surface the API in 3.3.
Comment 3 Michael D. Elder CLA 2006-02-23 23:44:20 EST
Drop assistants are associated with extensions, and they can define their own. 

I don't anticipate there ever being a large number of drag assistants; these are really a mechanism to add new Transfer Types.  
Comment 4 Michael D. Elder CLA 2006-02-23 23:46:18 EST
Created attachment 35282 [details]
Adds INavigatorDnDService.bindDragAssistant()
Comment 5 Nick Edgar CLA 2006-02-24 11:29:24 EST
Michael, it looks like this patch incorporates a bunch of other work than just the request here.  This makes it hard for me to review the API change for this request.  Would it be possible to provide a simpler patch?
Comment 6 Michael D. Elder CLA 2006-02-24 11:56:26 EST
Created attachment 35316 [details]
The real patch
Comment 7 Michael D. Elder CLA 2006-02-24 11:56:54 EST
I inadvertantly attached the patch for DND_126658 instead of this change. 
Comment 8 Nick Edgar CLA 2006-03-02 13:22:08 EST
Looks good to me.  McQ, you can +1 the API change.
Comment 9 Mike Wilson CLA 2006-03-02 13:29:21 EST
agreed. +1.  ok to proceed.
Comment 10 Michael Valenta CLA 2006-03-23 12:55:55 EST
Michael, this API change has gotten approval. It would be best if it made it into M6.
Comment 11 Michael D. Elder CLA 2006-03-28 15:51:18 EST
Released patch.