Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » DragAndDrop in AbstractDecoratedTextEditor
DragAndDrop in AbstractDecoratedTextEditor [message #544333] Fri, 02 July 2010 11:04 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Hi,
What is needed to enable D&D in a custom editor?

I currently do nothing specific and the drag operation seems to work
out-of-the-box... almost :(

When I drag the selected text cursor changes shape and the drop-position
indicator (thick vertical beam) loosely follows it.
Problem is when I drop it nothing happens (and sometimes I have a
leftover insertion point marker), so I think I didn't do some required
initialization.

Before You ask: Yes, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED is set to true.

I also saw "protected void initializeDragAndDrop(ISourceViewer viewer)",
but I don't know how to use it. Searches didn't turn up anything usable.

Can someone help me, pretty please?

Thanks in Advance
Mauro
Re: DragAndDrop in AbstractDecoratedTextEditor [message #544635 is a reply to message #544333] Mon, 05 July 2010 07:40 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Mauro Condarelli wrote:
> Hi,
> What is needed to enable D&D in a custom editor?
>
> I currently do nothing specific and the drag operation seems to work
> out-of-the-box... almost :(
>
> When I drag the selected text cursor changes shape and the
> drop-position indicator (thick vertical beam) loosely follows it.
> Problem is when I drop it nothing happens (and sometimes I have a
> leftover insertion point marker), so I think I didn't do some required
> initialization.
>
> Before You ask: Yes, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED is set to
> true.
>
> I also saw "protected void initializeDragAndDrop(ISourceViewer
> viewer)", but I don't know how to use it. Searches didn't turn up
> anything usable.
>
> Can someone help me, pretty please?
It should work out of the box (see e.g. Java editor or source pages in
PDE editors). No idea what your editor tweaks to break this.

Dani
>
> Thanks in Advance
> Mauro
Re: DragAndDrop in AbstractDecoratedTextEditor [message #544707 is a reply to message #544635] Mon, 05 July 2010 09:54 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
On 05/07/2010 9.40, Daniel Megert wrote:
> Mauro Condarelli wrote:
>> Hi,
>> What is needed to enable D&D in a custom editor?
>>
>> I currently do nothing specific and the drag operation seems to work
>> out-of-the-box... almost :(
>>
>> When I drag the selected text cursor changes shape and the
>> drop-position indicator (thick vertical beam) loosely follows it.
>> Problem is when I drop it nothing happens (and sometimes I have a
>> leftover insertion point marker), so I think I didn't do some required
>> initialization.
>>
>> Before You ask: Yes, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED is set to
>> true.
>>
>> I also saw "protected void initializeDragAndDrop(ISourceViewer
>> viewer)", but I don't know how to use it. Searches didn't turn up
>> anything usable.
>>
>> Can someone help me, pretty please?
> It should work out of the box (see e.g. Java editor or source pages in
> PDE editors). No idea what your editor tweaks to break this.
>
> Dani
>>
>> Thanks in Advance
>> Mauro

Thanks Daniel,
any suggestion where to put a breakpoint to debug this?

TiA
Mauro
Re: DragAndDrop in AbstractDecoratedTextEditor [message #545509 is a reply to message #544707] Thu, 08 July 2010 06:19 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Mauro Condarelli wrote:
> On 05/07/2010 9.40, Daniel Megert wrote:
>> Mauro Condarelli wrote:
>>> Hi,
>>> What is needed to enable D&D in a custom editor?
>>>
>>> I currently do nothing specific and the drag operation seems to work
>>> out-of-the-box... almost :(
>>>
>>> When I drag the selected text cursor changes shape and the
>>> drop-position indicator (thick vertical beam) loosely follows it.
>>> Problem is when I drop it nothing happens (and sometimes I have a
>>> leftover insertion point marker), so I think I didn't do some required
>>> initialization.
>>>
>>> Before You ask: Yes, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED is set to
>>> true.
>>>
>>> I also saw "protected void initializeDragAndDrop(ISourceViewer
>>> viewer)", but I don't know how to use it. Searches didn't turn up
>>> anything usable.
>>>
>>> Can someone help me, pretty please?
>> It should work out of the box (see e.g. Java editor or source pages in
>> PDE editors). No idea what your editor tweaks to break this.
>>
>> Dani
>>>
>>> Thanks in Advance
>>> Mauro
>
> Thanks Daniel,
> any suggestion where to put a breakpoint to debug this?
Inside
org.eclipse.ui.texteditor.AbstractTextEditor.installTextDrag AndDrop(ISourceViewer).
My guess however is that someone else also registers for DnD and
disables the text editor's DnD support. If you try to write a
MultiEditor you might want to look at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=212244

Dani
>
> TiA
> Mauro
Re: DragAndDrop in AbstractDecoratedTextEditor [message #545581 is a reply to message #545509] Thu, 08 July 2010 10:19 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
On 08/07/2010 8.19, Daniel Megert wrote:
> Mauro Condarelli wrote:
>> On 05/07/2010 9.40, Daniel Megert wrote:
>>> Mauro Condarelli wrote:
>>>> Hi,
>>>> What is needed to enable D&D in a custom editor?
>>>>
>>>> I currently do nothing specific and the drag operation seems to work
>>>> out-of-the-box... almost :(
>>>>
>>>> When I drag the selected text cursor changes shape and the
>>>> drop-position indicator (thick vertical beam) loosely follows it.
>>>> Problem is when I drop it nothing happens (and sometimes I have a
>>>> leftover insertion point marker), so I think I didn't do some required
>>>> initialization.
>>>>
>>>> Before You ask: Yes, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED is set to
>>>> true.
>>>>
>>>> I also saw "protected void initializeDragAndDrop(ISourceViewer
>>>> viewer)", but I don't know how to use it. Searches didn't turn up
>>>> anything usable.
>>>>
>>>> Can someone help me, pretty please?
>>> It should work out of the box (see e.g. Java editor or source pages in
>>> PDE editors). No idea what your editor tweaks to break this.
>>>
>>> Dani
>>>>
>>>> Thanks in Advance
>>>> Mauro
>>
>> Thanks Daniel,
>> any suggestion where to put a breakpoint to debug this?
> Inside
> org.eclipse.ui.texteditor.AbstractTextEditor.installTextDrag AndDrop(ISourceViewer).
> My guess however is that someone else also registers for DnD and
> disables the text editor's DnD support. If you try to write a
> MultiEditor you might want to look at
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=212244

I do not believe The bug is relevant because I have a main editor
"WorldEditor extends FormEditor" and, deep inside a page, I have a
"SceneEditor extends AbstractDecoratedTextEditor"; none of which has a
MultiEditor in its ancestry.


I put a series of breakponts and in the installed DropTargetAdapter and
I see calls to (in order):
dragStart()
isLocationSelected()
dragEnter()
dragOver()

.... and that's it.
I see no other calls; in particular I would expect to see at least
dragSetData() dragFinished() and drop()!
This is consitent with the fact the insertion pointer (thick vertical
bar) does not disappear.

I also tried setting breakpoints to
EditorSiteDragAndDropServiceImpl.realDropTarget.drop() but it is not called.

I also checked, but there's no call to removeMergedDropTarget().

EditorSiteDragAndDropServiceImpl.getCurrentDropTarget() is not called
after initialization either.

The only places where I have the word "drop" in my code is where I
implement D&D between two lists (actually from a List to a Table), but
that's another page and should not interfere (and works).

Any other idea about what I could have screwed so badly?

Thanks
Mauro

>
> Dani
>>
>> TiA
>> Mauro
Re: DragAndDrop in AbstractDecoratedTextEditor [message #553758 is a reply to message #545581] Wed, 18 August 2010 17:17 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
I am still struggling with this problem.
I have now a further data-point that could be meaningful for some
knowledgeable person:

I noticed that, for my editor, when
org.eclipse.ui.texteditor.AbstractTextEditor.initializeDragA ndDrop(ISourceViewer)
is called it fails:

Object object= Platform.getAdapterManager().loadAdapter(this,
"org.eclipse.ui.texteditor.ITextEditorDropTargetListener");

returns null.

This seems a good reason why Drag&Dtop it doesn't work, but I do not
know what I did to break it.

Probably I'm missing some required dependency, but I really don't know what.

Does this ring some bell somewhere?

Thanks
Mauro


On 08/07/2010 12.19, Mauro Condarelli wrote:
> On 08/07/2010 8.19, Daniel Megert wrote:
>> Mauro Condarelli wrote:
>>> On 05/07/2010 9.40, Daniel Megert wrote:
>>>> Mauro Condarelli wrote:
>>>>> Hi,
>>>>> What is needed to enable D&D in a custom editor?
>>>>>
>>>>> I currently do nothing specific and the drag operation seems to work
>>>>> out-of-the-box... almost :(
>>>>>
>>>>> When I drag the selected text cursor changes shape and the
>>>>> drop-position indicator (thick vertical beam) loosely follows it.
>>>>> Problem is when I drop it nothing happens (and sometimes I have a
>>>>> leftover insertion point marker), so I think I didn't do some required
>>>>> initialization.
>>>>>
>>>>> Before You ask: Yes, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED is set to
>>>>> true.
>>>>>
>>>>> I also saw "protected void initializeDragAndDrop(ISourceViewer
>>>>> viewer)", but I don't know how to use it. Searches didn't turn up
>>>>> anything usable.
>>>>>
>>>>> Can someone help me, pretty please?
>>>> It should work out of the box (see e.g. Java editor or source pages in
>>>> PDE editors). No idea what your editor tweaks to break this.
>>>>
>>>> Dani
>>>>>
>>>>> Thanks in Advance
>>>>> Mauro
>>>
>>> Thanks Daniel,
>>> any suggestion where to put a breakpoint to debug this?
>> Inside
>> org.eclipse.ui.texteditor.AbstractTextEditor.installTextDrag AndDrop(ISourceViewer).
>>
>> My guess however is that someone else also registers for DnD and
>> disables the text editor's DnD support. If you try to write a
>> MultiEditor you might want to look at
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=212244
>
> I do not believe The bug is relevant because I have a main editor
> "WorldEditor extends FormEditor" and, deep inside a page, I have a
> "SceneEditor extends AbstractDecoratedTextEditor"; none of which has a
> MultiEditor in its ancestry.
>
>
> I put a series of breakponts and in the installed DropTargetAdapter and
> I see calls to (in order):
> dragStart()
> isLocationSelected()
> dragEnter()
> dragOver()
>
> ... and that's it.
> I see no other calls; in particular I would expect to see at least
> dragSetData() dragFinished() and drop()!
> This is consitent with the fact the insertion pointer (thick vertical
> bar) does not disappear.
>
> I also tried setting breakpoints to
> EditorSiteDragAndDropServiceImpl.realDropTarget.drop() but it is not
> called.
>
> I also checked, but there's no call to removeMergedDropTarget().
>
> EditorSiteDragAndDropServiceImpl.getCurrentDropTarget() is not called
> after initialization either.
>
> The only places where I have the word "drop" in my code is where I
> implement D&D between two lists (actually from a List to a Table), but
> that's another page and should not interfere (and works).
>
> Any other idea about what I could have screwed so badly?
>
> Thanks
> Mauro
>
>>
>> Dani
>>>
>>> TiA
>>> Mauro
>
Re: DragAndDrop in AbstractDecoratedTextEditor [message #553831 is a reply to message #553758] Thu, 19 August 2010 06:30 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Mauro Condarelli wrote:
> I am still struggling with this problem.
> I have now a further data-point that could be meaningful for some
> knowledgeable person:
>
> I noticed that, for my editor, when
> org.eclipse.ui.texteditor.AbstractTextEditor.initializeDragA ndDrop(ISourceViewer)
>
> is called it fails:
>
> Object object= Platform.getAdapterManager().loadAdapter(this,
> "org.eclipse.ui.texteditor.ITextEditorDropTargetListener");
>
> returns null.
Actually, it would be an indication of a bug if it wasn't 'null'.
>
> This seems a good reason why Drag&Dtop it doesn't work, but I do not
> know what I did to break it.
>
> Probably I'm missing some required dependency, but I really don't know
> what.
The only thing I can say from the outside is that it looks like you try
to nest editors inside other ones and there some listeners seem not be
correctly installed and/or don't delegate the DnD events accordingly.

Dani
>
> Does this ring some bell somewhere?
>
> Thanks
> Mauro
>
>
> On 08/07/2010 12.19, Mauro Condarelli wrote:
>> On 08/07/2010 8.19, Daniel Megert wrote:
>>> Mauro Condarelli wrote:
>>>> On 05/07/2010 9.40, Daniel Megert wrote:
>>>>> Mauro Condarelli wrote:
>>>>>> Hi,
>>>>>> What is needed to enable D&D in a custom editor?
>>>>>>
>>>>>> I currently do nothing specific and the drag operation seems to work
>>>>>> out-of-the-box... almost :(
>>>>>>
>>>>>> When I drag the selected text cursor changes shape and the
>>>>>> drop-position indicator (thick vertical beam) loosely follows it.
>>>>>> Problem is when I drop it nothing happens (and sometimes I have a
>>>>>> leftover insertion point marker), so I think I didn't do some
>>>>>> required
>>>>>> initialization.
>>>>>>
>>>>>> Before You ask: Yes, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED is set to
>>>>>> true.
>>>>>>
>>>>>> I also saw "protected void initializeDragAndDrop(ISourceViewer
>>>>>> viewer)", but I don't know how to use it. Searches didn't turn up
>>>>>> anything usable.
>>>>>>
>>>>>> Can someone help me, pretty please?
>>>>> It should work out of the box (see e.g. Java editor or source
>>>>> pages in
>>>>> PDE editors). No idea what your editor tweaks to break this.
>>>>>
>>>>> Dani
>>>>>>
>>>>>> Thanks in Advance
>>>>>> Mauro
>>>>
>>>> Thanks Daniel,
>>>> any suggestion where to put a breakpoint to debug this?
>>> Inside
>>> org.eclipse.ui.texteditor.AbstractTextEditor.installTextDrag AndDrop(ISourceViewer).
>>>
>>>
>>> My guess however is that someone else also registers for DnD and
>>> disables the text editor's DnD support. If you try to write a
>>> MultiEditor you might want to look at
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=212244
>>
>> I do not believe The bug is relevant because I have a main editor
>> "WorldEditor extends FormEditor" and, deep inside a page, I have a
>> "SceneEditor extends AbstractDecoratedTextEditor"; none of which has a
>> MultiEditor in its ancestry.
>>
>>
>> I put a series of breakponts and in the installed DropTargetAdapter and
>> I see calls to (in order):
>> dragStart()
>> isLocationSelected()
>> dragEnter()
>> dragOver()
>>
>> ... and that's it.
>> I see no other calls; in particular I would expect to see at least
>> dragSetData() dragFinished() and drop()!
>> This is consitent with the fact the insertion pointer (thick vertical
>> bar) does not disappear.
>>
>> I also tried setting breakpoints to
>> EditorSiteDragAndDropServiceImpl.realDropTarget.drop() but it is not
>> called.
>>
>> I also checked, but there's no call to removeMergedDropTarget().
>>
>> EditorSiteDragAndDropServiceImpl.getCurrentDropTarget() is not called
>> after initialization either.
>>
>> The only places where I have the word "drop" in my code is where I
>> implement D&D between two lists (actually from a List to a Table), but
>> that's another page and should not interfere (and works).
>>
>> Any other idea about what I could have screwed so badly?
>>
>> Thanks
>> Mauro
>>
>>>
>>> Dani
>>>>
>>>> TiA
>>>> Mauro
>>
>
Previous Topic:load plugin programmatically
Next Topic:[Commands] locationURI and menubarPath
Goto Forum:
  


Current Time: Thu Apr 25 19:48:48 GMT 2024

Powered by FUDForum. Page generated in 0.03336 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top