Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table#getTopIndex returns negative value
icon5.gif  Table#getTopIndex returns negative value [message #500146] Wed, 25 November 2009 08:24 Go to next message
Pierre Schubert is currently offline Pierre SchubertFriend
Messages: 1
Registered: July 2009
Junior Member
Hi everyone,

I have a problem with DND in conjunction with a table.

It appears on my Mac (OS X 10.6.2 64 bit) with the swt.cocoa (3.5.1v3555a) plugin.

I've added a DropTarget (DND.DROP_COPY) to a table in a shell. When I try to drop something on it, the following exception will be thrown:

!ENTRY org.eclipse.ui 4 0 2009-11-25 08:49:40.661
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.IllegalArgumentException: Index out of bounds
	at org.eclipse.swt.SWT.error(SWT.java:3865)
	at org.eclipse.swt.SWT.error(SWT.java:3799)
	at org.eclipse.swt.SWT.error(SWT.java:3770)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:619)
	at org.eclipse.swt.widgets.Table.getItem(Table.java:1420)
	at org.eclipse.swt.dnd.DropTargetEffect.getItem(DropTargetEffect.java:107)
	at org.eclipse.swt.dnd.DropTargetEffect.getItem(DropTargetEffect.java:90)
	at org.eclipse.swt.dnd.DropTarget.setEventData(DropTarget.java:873)
	at org.eclipse.swt.dnd.DropTarget.draggingUpdated(DropTarget.java:280)
	at org.eclipse.swt.dnd.DropTarget.dropTargetProc(DropTarget.java:430)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend_bool(Native Method)
	at org.eclipse.swt.internal.cocoa.NSRunLoop.runMode(NSRunLoop.java:42)
	at org.eclipse.swt.widgets.Display.sleep(Display.java:3905)
	at org.eclipse.ui.application.WorkbenchAdvisor.eventLoopIdle(WorkbenchAdvisor.java:364)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2406)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	...

I've debugged the code and found out that the method Table#getTopIndex returns -1 at DropTargetEvent.class:106.

The result is, that the method Table#getItem will be called with -1 and an IllegalArgumentException (Index out of bounds) will be thrown.

The javadoc of the method Table#getTopIndex says:

Returns the zero-relative index of the item which is currently at the top of the receiver...

Therefore I conclude that something is wrong with #getTopIndex method.

If the table has initially one or more items, everything works just fine.

Thanks for every contribution.

Kind regards

Pierre Schubert
Re: Table#getTopIndex returns negative value [message #500690 is a reply to message #500146] Fri, 27 November 2009 14:16 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
Hi Pierre,

You're seeing https://bugs.eclipse.org/bugs/show_bug.cgi?id=287234 , which
is fixed in the 3.6 stream. The only workaround I can suggest in the
meantime is to give the Table an empty initial item which gets removed when
the Table receives its real content.

Grant


"Pierre Schubert" <pschubert@quintessence.net> wrote in message
news:heipk1$p51$1@build.eclipse.org...
> Hi everyone,
>
> I have a problem with DND in conjunction with a table.
>
> It appears on my Mac (OS X 10.6.2 64 bit) with the swt.cocoa (3.5.1v3555a)
plugin.
>
> I've added a DropTarget (DND.DROP_COPY) to a table in a shell. When I try
to drop something on it, the following exception will be thrown:
>
> !ENTRY org.eclipse.ui 4 0 2009-11-25 08:49:40.661
> !MESSAGE Unhandled event loop exception
> !STACK 0
> java.lang.IllegalArgumentException: Index out of bounds
> at org.eclipse.swt.SWT.error(SWT.java:3865)
> at org.eclipse.swt.SWT.error(SWT.java:3799)
> at org.eclipse.swt.SWT.error(SWT.java:3770)
> at org.eclipse.swt.widgets.Widget.error(Widget.java:619)
> at org.eclipse.swt.widgets.Table.getItem(Table.java:1420)
> at org.eclipse.swt.dnd.DropTargetEffect.getItem(DropTargetEffec t.java:107)
> at org.eclipse.swt.dnd.DropTargetEffect.getItem(DropTargetEffec t.java:90)
> at org.eclipse.swt.dnd.DropTarget.setEventData(DropTarget.java: 873)
> at org.eclipse.swt.dnd.DropTarget.draggingUpdated(DropTarget.ja va:280)
> at org.eclipse.swt.dnd.DropTarget.dropTargetProc(DropTarget.jav a:430)
> at org.eclipse.swt.internal.cocoa.OS.objc_msgSend_bool(Native Method)
> at org.eclipse.swt.internal.cocoa.NSRunLoop.runMode(NSRunLoop.j ava:42)
> at org.eclipse.swt.widgets.Display.sleep(Display.java:3905)
> at
org.eclipse.ui.application.WorkbenchAdvisor.eventLoopIdle(Wo rkbenchAdvisor.j
ava:364)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2406)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 21)
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
> at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:332)
> at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:493)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> ...
> I've debugged the code and found out that the method Table#getTopIndex
returns -1 at DropTargetEvent.class:106.
>
> The result is, that the method Table#getItem will be called with -1 and an
IllegalArgumentException (Index out of bounds) will be thrown.
>
> The javadoc of the method Table#getTopIndex says:
>
> Returns the zero-relative index of the item which is currently at the top
of the receiver...
> Therefore I conclude that something is wrong with #getTopIndex method.
>
> If the table has initially one or more items, everything works just fine.
>
> Thanks for every contribution.
>
> Kind regards
>
> Pierre Schubert
>
Previous Topic:Multi-column tree with tree not in 1st column?
Next Topic:Issue with Browser and TraverseListener
Goto Forum:
  


Current Time: Fri Dec 19 08:17:12 GMT 2014

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

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