Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » DND + Table Selection: ordering of Events
DND + Table Selection: ordering of Events [message #489606] Mon, 05 October 2009 10:12 Go to next message
Fabian Zeindl is currently offline Fabian ZeindlFriend
Messages: 4
Registered: July 2009
Junior Member
Hi,

i have a DragSource on a table, which is populated by a data-view-class.
My problem is that I can't access the currently dragged item in dragSetData, cause on Windows the SelectionListeners on the table are always fired after the drag is finished.

It doesn't matter whether I add the DragSource before oder after the SelectionListener.

I haven't tried to access the Table's selection directly in SetData, since I have no use for TableItem, but I need the associated data, which is provided by my dataview-class.

Any Ideas?
fabian zeindl
Re: DND + Table Selection: ordering of Events [message #489703 is a reply to message #489606] Mon, 05 October 2009 15:17 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi,

Does data-view-class mean you're using a TableViewer? If so then there may
be a listener at the jface level that you should be using instead. Someone
on the eclipse.platform.jface newsgroup could tell you if this is the case.
(Or, does jface provide a way to map from an swt TableItem to an item in
your model?)

If this doesn't describe your case then you'll have to give some more info
(as always, a runnable snippet would be ideal).

Grant


"Fabian Zeindl" <fabian@xover.htu.tuwien.ac.at> wrote in message
news:hacgqt$17c$1@build.eclipse.org...
> Hi,
>
> i have a DragSource on a table, which is populated by a data-view-class.
> My problem is that I can't access the currently dragged item in
dragSetData, cause on Windows the SelectionListeners on the table are always
fired after the drag is finished.
>
> It doesn't matter whether I add the DragSource before oder after the
SelectionListener.
>
> I haven't tried to access the Table's selection directly in SetData, since
I have no use for TableItem, but I need the associated data, which is
provided by my dataview-class.
>
> Any Ideas?
> fabian zeindl
Re: DND + Table Selection: ordering of Events [message #489736 is a reply to message #489703] Mon, 05 October 2009 17:28 Go to previous messageGo to next message
Fabian Zeindl is currently offline Fabian ZeindlFriend
Messages: 4
Registered: July 2009
Junior Member
I'm using the GlazedLists package to populate my Tables, but that is not important.

I created a small TestCase explains what I mean:
1. drag the tableitem into the other table
2. as you see the selection-event always occurs after dragSetData, dragFinished etc. so i don't see a way to store the current selection in dragSetData in event.data.

http://gist.github.com/202258

ffabian

[Updated on: Mon, 05 October 2009 17:29]

Report message to a moderator

Re: DND + Table Selection: ordering of Events [message #489960 is a reply to message #489736] Tue, 06 October 2009 15:28 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
This looks like a bug so I've logged
https://bugs.eclipse.org/bugs/show_bug.cgi?id=291496 . On other platforms
the Selection event is sent early in the drag process.

As a workaround, maybe in the dragSetData() implementation you could create
an SWT Selection event with the current selection and invoke the viewer's
Selection listener manually (or by Table.notifyListeners(int, Event))? Then
it should be able to provide you with the appropriate data. If you do give
this a try then be sure to see if GlazedLists handles this situation fine
when it receives the second Selection event (the "real" one) for the same
item after the drop has completed. Also, you would probably only want to
send the fake event if SWT.getPlatform() answers "win32".

HTH,
Grant


"Fabian Zeindl" <fabian@xover.htu.tuwien.ac.at> wrote in message
news:hadac9$7pv$1@build.eclipse.org...
> I'm using the GlazedLists package to populate my Tables, but that is not
important.
>
> I created a small TestCase explains what I mean:
> 1. drag the tableitem into the other table
> 2. as you see the selection-event always occurs after dragSetData,
dragFinished etc. so i don't see a way to store the current selection in
dragSetData in event.data.
>
> ffabian
Previous Topic:Dynamically change theb SWT style of the Control object
Next Topic:ContentAssistant font change
Goto Forum:
  


Current Time: Thu Apr 18 18:40:10 GMT 2024

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

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

Back to the top