Home » Language IDEs » Java Development Tools (JDT) » drag and drop into CompilationUnitEditor
|
Re: drag and drop into CompilationUnitEditor [message #222249 is a reply to message #222214] |
Mon, 16 January 2006 14:29 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.eclipse.org
Gary,
there's currently no official support to do this directly. You might try
to register a org.eclipse.swt.dnd.DropTarget directly on the editor's
control:
Control ctrl= (Control)editor.getAdapter(Control.class);
if (ctrl != null) {
DropTarget dropTarget= new DropTarget(ctrl, <your DND styles>);
dropTarget.setTransfer(<your transfer agents>);
dropTarget.addDropListener(<your listener>);
}
HTH
Dani
Gary Horen wrote:
>The use case I am wondering about is that a user selects a widget in a View,
>drags, and drops it into the Java editor. The drop processor for this
>operation wants to add some code to the current compilation unit, I think
>via ASTRewrite. I found an article in the docs about drag + drop, dated 2003
>( http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html) which
>seems to imply that the response to dropping on an editor window was then
>limited to the workbench opening a resource in the appropriate editor. There
>is a drag + drop enhancement request for 3.2 (107846), but it looks like it
>pertains to dropping onto a View, not on an Editor. Is there a way to create
>a drop listener that will get called when a drop event onto the
>CompilationUnitEditor occurs?
>
>
>
>
|
|
|
Re: drag and drop into CompilationUnitEditor [message #223047 is a reply to message #222249] |
Wed, 25 January 2006 02:57 |
Gary Horen Messages: 18 Registered: July 2009 |
Junior Member |
|
|
Thanks Dani...
Next question: how do I get at the Editor? I know how to get at the
IEditorPart and IEditorSite, but I don't think that's the same thing:
getViewSite().getPage().getActiveEditor().getEditorSite()...
What is the path to the Editor itself, from a View, for example?
thanks again,
gary
"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
news:dqgajo$28l$1@utils.eclipse.org...
> Gary,
>
> there's currently no official support to do this directly. You might try
> to register a org.eclipse.swt.dnd.DropTarget directly on the editor's
> control:
> Control ctrl= (Control)editor.getAdapter(Control.class);
> if (ctrl != null) {
> DropTarget dropTarget= new DropTarget(ctrl, <your DND styles>);
> dropTarget.setTransfer(<your transfer agents>);
> dropTarget.addDropListener(<your listener>);
> }
>
> HTH
> Dani
>
> Gary Horen wrote:
>
>>The use case I am wondering about is that a user selects a widget in a
>>View, drags, and drops it into the Java editor. The drop processor for
>>this operation wants to add some code to the current compilation unit, I
>>think via ASTRewrite. I found an article in the docs about drag + drop,
>>dated 2003
>>( http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html)
>>which seems to imply that the response to dropping on an editor window was
>>then limited to the workbench opening a resource in the appropriate
>>editor. There is a drag + drop enhancement request for 3.2 (107846), but
>>it looks like it pertains to dropping onto a View, not on an Editor. Is
>>there a way to create a drop listener that will get called when a drop
>>event onto the CompilationUnitEditor occurs?
>>
>>
|
|
|
Re: drag and drop into CompilationUnitEditor [message #223061 is a reply to message #223047] |
Wed, 25 January 2006 09:50 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.eclipse.org
Gary Horen wrote:
>Thanks Dani...
>
>Next question: how do I get at the Editor? I know how to get at the
>IEditorPart and IEditorSite, but I don't think that's the same thing:
>
>
The IEditorPart is the (Java) editor.
Dani
> getViewSite().getPage().getActiveEditor().getEditorSite()...
>
>What is the path to the Editor itself, from a View, for example?
>
>thanks again,
>gary
>
>
>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>news:dqgajo$28l$1@utils.eclipse.org...
>
>
>>Gary,
>>
>>there's currently no official support to do this directly. You might try
>>to register a org.eclipse.swt.dnd.DropTarget directly on the editor's
>>control:
>>Control ctrl= (Control)editor.getAdapter(Control.class);
>>if (ctrl != null) {
>> DropTarget dropTarget= new DropTarget(ctrl, <your DND styles>);
>> dropTarget.setTransfer(<your transfer agents>);
>> dropTarget.addDropListener(<your listener>);
>>}
>>
>>HTH
>>Dani
>>
>>Gary Horen wrote:
>>
>>
>>
>>>The use case I am wondering about is that a user selects a widget in a
>>>View, drags, and drops it into the Java editor. The drop processor for
>>>this operation wants to add some code to the current compilation unit, I
>>>think via ASTRewrite. I found an article in the docs about drag + drop,
>>>dated 2003
>>>( http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html)
>>>which seems to imply that the response to dropping on an editor window was
>>>then limited to the workbench opening a resource in the appropriate
>>>editor. There is a drag + drop enhancement request for 3.2 (107846), but
>>>it looks like it pertains to dropping onto a View, not on an Editor. Is
>>>there a way to create a drop listener that will get called when a drop
>>>event onto the CompilationUnitEditor occurs?
>>>
>>>
>>>
>>>
>
>
>
>
|
|
|
Re: drag and drop into CompilationUnitEditor [message #223109 is a reply to message #223061] |
Thu, 26 January 2006 01:50 |
Gary Horen Messages: 18 Registered: July 2009 |
Junior Member |
|
|
This works, in that now I can construct a DropTargetListener that will
receive drop events when something is dropped on the Editor. This is great.
Next question: What I really want to do is to create a DropTarget on the
Editor's control, but when I receive a Transfer that I don't recognize, to
pass it along to the DropTarget that is already in effect for the Editor. I
don't want to pre-empt and swallow a drop event that the Editor already
supports. I'd love it if it just worked like that, but the way it works now
is that if my DropTarget isn't set up to receive JavaElementTransfers (an
internal object anyway, don't want to receive those), then the Editor does
not accept drops of files from the Package Explorer anymore.
Control#getData("DropTarget") will not give me the currently connected
DropTarget; it returns null (and I really don't want to make that call
anyway since "DropTarget" is actually a value private to the DropTarget
class). Do you have a suggestion about how I can find an object to pass a
drop event that is not mine along to? Or is there some feedback I should be
giving the Listener#dragEnter() method that will tell it that I don't own
the event, and it should find another that does?
Here is the experimental code that attaches the DropTarget to the control.
The listener is currently doing nothing with the Events.
private void hookDragonDrop()
{
Control ctl = (Control)
getViewSite().getPage().getActiveEditor().getAdapter(Control .class);
if (ctl != null) {
DropTarget dt = new DropTarget(ctl, DND.DROP_COPY | DND.DROP_MOVE |
DND.DROP_LINK);
Transfer[] trans = {FileTransfer.getInstance(),
JavaElementTransfer.getInstance()};
dt.setTransfer(trans);
DropTargetListener listener = new MyDropListener();
dt.addDropListener(listener);
}
}
thanks again.
"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
news:dr7hm4$fhe$2@utils.eclipse.org...
> Gary Horen wrote:
>
>>Thanks Dani...
>>
>>Next question: how do I get at the Editor? I know how to get at the
>>IEditorPart and IEditorSite, but I don't think that's the same thing:
>>
> The IEditorPart is the (Java) editor.
>
> Dani
>
>> getViewSite().getPage().getActiveEditor().getEditorSite()...
>>
>>What is the path to the Editor itself, from a View, for example?
>>
>>thanks again,
>>gary
>>
>>
>>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>>news:dqgajo$28l$1@utils.eclipse.org...
>>
>>>Gary,
>>>
>>>there's currently no official support to do this directly. You might try
>>>to register a org.eclipse.swt.dnd.DropTarget directly on the editor's
>>>control:
>>>Control ctrl= (Control)editor.getAdapter(Control.class);
>>>if (ctrl != null) {
>>> DropTarget dropTarget= new DropTarget(ctrl, <your DND styles>);
>>> dropTarget.setTransfer(<your transfer agents>);
>>> dropTarget.addDropListener(<your listener>);
>>>}
>>>
>>>HTH
>>>Dani
>>>
>>>Gary Horen wrote:
>>>
>>>
>>>>The use case I am wondering about is that a user selects a widget in a
>>>>View, drags, and drops it into the Java editor. The drop processor for
>>>>this operation wants to add some code to the current compilation unit, I
>>>>think via ASTRewrite. I found an article in the docs about drag + drop,
>>>>dated 2003
>>>>( http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html)
>>>>which seems to imply that the response to dropping on an editor window
>>>>was then limited to the workbench opening a resource in the appropriate
>>>>editor. There is a drag + drop enhancement request for 3.2 (107846), but
>>>>it looks like it pertains to dropping onto a View, not on an Editor. Is
>>>>there a way to create a drop listener that will get called when a drop
>>>>event onto the CompilationUnitEditor occurs?
>>>>
>>>>
>>>>
>>
>>
>>
|
|
|
Re: drag and drop into CompilationUnitEditor [message #223296 is a reply to message #223109] |
Mon, 30 January 2006 14:52 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.eclipse.org
Gary Horen wrote:
>This works, in that now I can construct a DropTargetListener that will
>receive drop events when something is dropped on the Editor. This is great.
>
>Next question: What I really want to do is to create a DropTarget on the
>Editor's control, but when I receive a Transfer that I don't recognize, to
>pass it along to the DropTarget that is already in effect for the Editor. I
>don't want to pre-empt and swallow a drop event that the Editor already
>supports.
>
The editor doesn't do this, it's probably a listener on the parent
control. Try to set the event detail to DND.DROP_NONE.
Dani
>I'd love it if it just worked like that, but the way it works now
>is that if my DropTarget isn't set up to receive JavaElementTransfers (an
>internal object anyway, don't want to receive those), then the Editor does
>not accept drops of files from the Package Explorer anymore.
>
>Control#getData("DropTarget") will not give me the currently connected
>DropTarget; it returns null (and I really don't want to make that call
>anyway since "DropTarget" is actually a value private to the DropTarget
>class). Do you have a suggestion about how I can find an object to pass a
>drop event that is not mine along to? Or is there some feedback I should be
>giving the Listener#dragEnter() method that will tell it that I don't own
>the event, and it should find another that does?
>
>Here is the experimental code that attaches the DropTarget to the control.
>The listener is currently doing nothing with the Events.
>
> private void hookDragonDrop()
> {
>
> Control ctl = (Control)
> getViewSite().getPage().getActiveEditor().getAdapter(Control .class);
> if (ctl != null) {
> DropTarget dt = new DropTarget(ctl, DND.DROP_COPY | DND.DROP_MOVE |
>DND.DROP_LINK);
> Transfer[] trans = {FileTransfer.getInstance(),
>JavaElementTransfer.getInstance()};
> dt.setTransfer(trans);
> DropTargetListener listener = new MyDropListener();
> dt.addDropListener(listener);
> }
>
> }
>
>
>
>
>thanks again.
>
>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>news:dr7hm4$fhe$2@utils.eclipse.org...
>
>
>>Gary Horen wrote:
>>
>>
>>
>>>Thanks Dani...
>>>
>>>Next question: how do I get at the Editor? I know how to get at the
>>>IEditorPart and IEditorSite, but I don't think that's the same thing:
>>>
>>>
>>>
>>The IEditorPart is the (Java) editor.
>>
>>Dani
>>
>>
>>
>>> getViewSite().getPage().getActiveEditor().getEditorSite()...
>>>
>>>What is the path to the Editor itself, from a View, for example?
>>>
>>>thanks again,
>>>gary
>>>
>>>
>>>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>>>news:dqgajo$28l$1@utils.eclipse.org...
>>>
>>>
>>>
>>>>Gary,
>>>>
>>>>there's currently no official support to do this directly. You might try
>>>>to register a org.eclipse.swt.dnd.DropTarget directly on the editor's
>>>>control:
>>>>Control ctrl= (Control)editor.getAdapter(Control.class);
>>>>if (ctrl != null) {
>>>> DropTarget dropTarget= new DropTarget(ctrl, <your DND styles>);
>>>> dropTarget.setTransfer(<your transfer agents>);
>>>> dropTarget.addDropListener(<your listener>);
>>>>}
>>>>
>>>>HTH
>>>>Dani
>>>>
>>>>Gary Horen wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>The use case I am wondering about is that a user selects a widget in a
>>>>>View, drags, and drops it into the Java editor. The drop processor for
>>>>>this operation wants to add some code to the current compilation unit, I
>>>>>think via ASTRewrite. I found an article in the docs about drag + drop,
>>>>>dated 2003
>>>>>( http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html)
>>>>>which seems to imply that the response to dropping on an editor window
>>>>>was then limited to the workbench opening a resource in the appropriate
>>>>>editor. There is a drag + drop enhancement request for 3.2 (107846), but
>>>>>it looks like it pertains to dropping onto a View, not on an Editor. Is
>>>>>there a way to create a drop listener that will get called when a drop
>>>>>event onto the CompilationUnitEditor occurs?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>
>
>
>
|
|
|
Re: drag and drop into CompilationUnitEditor [message #223414 is a reply to message #223296] |
Tue, 31 January 2006 03:06 |
Gary Horen Messages: 18 Registered: July 2009 |
Junior Member |
|
|
Hi again Dani (or whoever else chooses to respond) ...
I assume that in your last suggestion, you meant to set detail =
DND.DROP_NONE in the drop() method, but I'm not sure. When I do this, I get
a slightly different behavior: a progress dialog appears briefly on the
screen, but the original behavior does not happen. So the event is not (to
all appearances) being passed on to the handler that was there before I
registered my listener.
After some digging (and hacking) around, it looks to be like what I need to
be able to do (in order to preempt the drop events I care about, and let the
ones I don't manifest their original behavior), is to pass those that I
don't care about on, to the o.e.ui.internal.ide.EditorAreaDropAdapter, which
actually implements behavior like opening a file that's dragged in from the
pkg explorer. EditorAreaDropAdapter is, of course, not accessible to me
without some serious prying open of things I'm not supposed to touch :)
Am I right in the preceding paragraph? Or is there a solution that I'm
missing? And is this a discussion that I actually should be having with the
platform people (in which case I would stop bothering you? :)
thanks again,
-Gary
"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
news:drl986$98u$1@utils.eclipse.org...
> Gary Horen wrote:
>
>>This works, in that now I can construct a DropTargetListener that will
>>receive drop events when something is dropped on the Editor. This is
>>great.
>>
>>Next question: What I really want to do is to create a DropTarget on the
>>Editor's control, but when I receive a Transfer that I don't recognize, to
>>pass it along to the DropTarget that is already in effect for the Editor.
>>I don't want to pre-empt and swallow a drop event that the Editor already
>>supports.
> The editor doesn't do this, it's probably a listener on the parent
> control. Try to set the event detail to DND.DROP_NONE.
>
> Dani
>
>>I'd love it if it just worked like that, but the way it works now is that
>>if my DropTarget isn't set up to receive JavaElementTransfers (an internal
>>object anyway, don't want to receive those), then the Editor does not
>>accept drops of files from the Package Explorer anymore.
>>
>>Control#getData("DropTarget") will not give me the currently connected
>>DropTarget; it returns null (and I really don't want to make that call
>>anyway since "DropTarget" is actually a value private to the DropTarget
>>class). Do you have a suggestion about how I can find an object to pass a
>>drop event that is not mine along to? Or is there some feedback I should
>>be giving the Listener#dragEnter() method that will tell it that I don't
>>own the event, and it should find another that does?
>>
>>Here is the experimental code that attaches the DropTarget to the control.
>>The listener is currently doing nothing with the Events.
>>
>> private void hookDragonDrop()
>> {
>>
>> Control ctl = (Control)
>> getViewSite().getPage().getActiveEditor().getAdapter(Control .class);
>> if (ctl != null) {
>> DropTarget dt = new DropTarget(ctl, DND.DROP_COPY | DND.DROP_MOVE |
>> DND.DROP_LINK);
>> Transfer[] trans = {FileTransfer.getInstance(),
>> JavaElementTransfer.getInstance()};
>> dt.setTransfer(trans);
>> DropTargetListener listener = new MyDropListener();
>> dt.addDropListener(listener);
>> }
>>
>> }
>>
>>
>>
>>
>>thanks again.
>>
>>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>>news:dr7hm4$fhe$2@utils.eclipse.org...
>>
>>>Gary Horen wrote:
>>>
>>>
>>>>Thanks Dani...
>>>>
>>>>Next question: how do I get at the Editor? I know how to get at the
>>>>IEditorPart and IEditorSite, but I don't think that's the same thing:
>>>>
>>>>
>>>The IEditorPart is the (Java) editor.
>>>
>>>Dani
>>>
>>>
>>>> getViewSite().getPage().getActiveEditor().getEditorSite()...
>>>>
>>>>What is the path to the Editor itself, from a View, for example?
>>>>
>>>>thanks again,
>>>>gary
>>>>
>>>>
>>>>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>>>>news:dqgajo$28l$1@utils.eclipse.org...
>>>>
>>>>
>>>>>Gary,
>>>>>
>>>>>there's currently no official support to do this directly. You might
>>>>>try to register a org.eclipse.swt.dnd.DropTarget directly on the
>>>>>editor's control:
>>>>>Control ctrl= (Control)editor.getAdapter(Control.class);
>>>>>if (ctrl != null) {
>>>>> DropTarget dropTarget= new DropTarget(ctrl, <your DND styles>);
>>>>> dropTarget.setTransfer(<your transfer agents>);
>>>>> dropTarget.addDropListener(<your listener>);
>>>>>}
>>>>>
>>>>>HTH
>>>>>Dani
>>>>>
>>>>>Gary Horen wrote:
>>>>>
>>>>>
>>>>>
>>>>>>The use case I am wondering about is that a user selects a widget in a
>>>>>>View, drags, and drops it into the Java editor. The drop processor for
>>>>>>this operation wants to add some code to the current compilation unit,
>>>>>>I think via ASTRewrite. I found an article in the docs about drag +
>>>>>>drop, dated 2003
>>>>>>( http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html)
>>>>>>which seems to imply that the response to dropping on an editor window
>>>>>>was then limited to the workbench opening a resource in the
>>>>>>appropriate editor. There is a drag + drop enhancement request for 3.2
>>>>>>(107846), but it looks like it pertains to dropping onto a View, not
>>>>>>on an Editor. Is there a way to create a drop listener that will get
>>>>>>called when a drop event onto the CompilationUnitEditor occurs?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
>>
|
|
|
Re: drag and drop into CompilationUnitEditor [message #223451 is a reply to message #223414] |
Tue, 31 January 2006 13:59 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.eclipse.org
Gary Horen wrote:
>Hi again Dani (or whoever else chooses to respond) ...
>I assume that in your last suggestion, you meant to set detail =
>DND.DROP_NONE in the drop() method, but I'm not sure. When I do this, I get
>a slightly different behavior: a progress dialog appears briefly on the
>screen, but the original behavior does not happen. So the event is not (to
>all appearances) being passed on to the handler that was there before I
>registered my listener.
>
>After some digging (and hacking) around, it looks to be like what I need to
>be able to do (in order to preempt the drop events I care about, and let the
>ones I don't manifest their original behavior), is to pass those that I
>don't care about on, to the o.e.ui.internal.ide.EditorAreaDropAdapter, which
>actually implements behavior like opening a file that's dragged in from the
>pkg explorer. EditorAreaDropAdapter is, of course, not accessible to me
>without some serious prying open of things I'm not supposed to touch :)
>
>Am I right in the preceding paragraph? Or is there a solution that I'm
>missing? And is this a discussion that I actually should be having with the
>platform people (in which case I would stop bothering you? :)
>
>
Gary,
yes, I would expect that event.detail= DND.DROP_NONE would do the trick
and as you noticed there was some different behaviour. It's really an
SWT question though and I'd ask there. Please let me know of the outcome.
Dani
>thanks again,
>-Gary
>
>
>
>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>news:drl986$98u$1@utils.eclipse.org...
>
>
>>Gary Horen wrote:
>>
>>
>>
>>>This works, in that now I can construct a DropTargetListener that will
>>>receive drop events when something is dropped on the Editor. This is
>>>great.
>>>
>>>Next question: What I really want to do is to create a DropTarget on the
>>>Editor's control, but when I receive a Transfer that I don't recognize, to
>>>pass it along to the DropTarget that is already in effect for the Editor.
>>>I don't want to pre-empt and swallow a drop event that the Editor already
>>>supports.
>>>
>>>
>>The editor doesn't do this, it's probably a listener on the parent
>>control. Try to set the event detail to DND.DROP_NONE.
>>
>>Dani
>>
>>
>>
>>>I'd love it if it just worked like that, but the way it works now is that
>>>if my DropTarget isn't set up to receive JavaElementTransfers (an internal
>>>object anyway, don't want to receive those), then the Editor does not
>>>accept drops of files from the Package Explorer anymore.
>>>
>>>Control#getData("DropTarget") will not give me the currently connected
>>>DropTarget; it returns null (and I really don't want to make that call
>>>anyway since "DropTarget" is actually a value private to the DropTarget
>>>class). Do you have a suggestion about how I can find an object to pass a
>>>drop event that is not mine along to? Or is there some feedback I should
>>>be giving the Listener#dragEnter() method that will tell it that I don't
>>>own the event, and it should find another that does?
>>>
>>>Here is the experimental code that attaches the DropTarget to the control.
>>>The listener is currently doing nothing with the Events.
>>>
>>>private void hookDragonDrop()
>>>{
>>>
>>> Control ctl = (Control)
>>> getViewSite().getPage().getActiveEditor().getAdapter(Control .class);
>>> if (ctl != null) {
>>> DropTarget dt = new DropTarget(ctl, DND.DROP_COPY | DND.DROP_MOVE |
>>>DND.DROP_LINK);
>>> Transfer[] trans = {FileTransfer.getInstance(),
>>>JavaElementTransfer.getInstance()};
>>> dt.setTransfer(trans);
>>> DropTargetListener listener = new MyDropListener();
>>> dt.addDropListener(listener);
>>> }
>>>
>>>}
>>>
>>>
>>>
>>>
>>>thanks again.
>>>
>>>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>>>news:dr7hm4$fhe$2@utils.eclipse.org...
>>>
>>>
>>>
>>>>Gary Horen wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>Thanks Dani...
>>>>>
>>>>>Next question: how do I get at the Editor? I know how to get at the
>>>>>IEditorPart and IEditorSite, but I don't think that's the same thing:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>The IEditorPart is the (Java) editor.
>>>>
>>>>Dani
>>>>
>>>>
>>>>
>>>>
>>>>> getViewSite().getPage().getActiveEditor().getEditorSite()...
>>>>>
>>>>>What is the path to the Editor itself, from a View, for example?
>>>>>
>>>>>thanks again,
>>>>>gary
>>>>>
>>>>>
>>>>>"Daniel Megert" <daniel.megert@eclipse.org> wrote in message
>>>>>news:dqgajo$28l$1@utils.eclipse.org...
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Gary,
>>>>>>
>>>>>>there's currently no official support to do this directly. You might
>>>>>>try to register a org.eclipse.swt.dnd.DropTarget directly on the
>>>>>>editor's control:
>>>>>>Control ctrl= (Control)editor.getAdapter(Control.class);
>>>>>>if (ctrl != null) {
>>>>>> DropTarget dropTarget= new DropTarget(ctrl, <your DND styles>);
>>>>>> dropTarget.setTransfer(<your transfer agents>);
>>>>>> dropTarget.addDropListener(<your listener>);
>>>>>>}
>>>>>>
>>>>>>HTH
>>>>>>Dani
>>>>>>
>>>>>>Gary Horen wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>The use case I am wondering about is that a user selects a widget in a
>>>>>>>View, drags, and drops it into the Java editor. The drop processor for
>>>>>>>this operation wants to add some code to the current compilation unit,
>>>>>>>I think via ASTRewrite. I found an article in the docs about drag +
>>>>>>>drop, dated 2003
>>>>>>>( http://www.eclipse.org/articles/Article-Workbench-DND/drag_d rop.html)
>>>>>>>which seems to imply that the response to dropping on an editor window
>>>>>>>was then limited to the workbench opening a resource in the
>>>>>>>appropriate editor. There is a drag + drop enhancement request for 3.2
>>>>>>>(107846), but it looks like it pertains to dropping onto a View, not
>>>>>>>on an Editor. Is there a way to create a drop listener that will get
>>>>>>>called when a drop event onto the CompilationUnitEditor occurs?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>>>
>
>
>
>
|
|
| | | |
Goto Forum:
Current Time: Wed Feb 05 04:54:16 GMT 2025
Powered by FUDForum. Page generated in 0.06341 seconds
|