Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312943

Summary: IllegalArgumentException when opening the header context menu in a datapool with no records.
Product: z_Archived Reporter: Paul Slauenwhite <paulslau>
Component: TPTPAssignee: Paul Slauenwhite <paulslau>
Status: CLOSED FIXED QA Contact: Kathy Chan <kathy>
Severity: major    
Priority: P2 CC: paulslau
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch. none

Description Paul Slauenwhite CLA 2010-05-14 12:55:34 EDT
IllegalArgumentException when opening the header context menu in a datapool with no records.

Create a datapool with one or more variables and no records and attempt to open the header context menu.  The following exception is thrown:

java.lang.IllegalArgumentException: Index out of bounds
	at org.eclipse.swt.SWT.error(SWT.java:4064)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.SWT.error(SWT.java:3969)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:467)
	at org.eclipse.swt.widgets.Table.getItem(Table.java:2496)
	at org.eclipse.hyades.test.ui.datapool.internal.control.DatapoolTable.getColumnIndex(DatapoolTable.java:1283)
	at org.eclipse.hyades.test.ui.datapool.internal.control.DatapoolTable.access$25(DatapoolTable.java:1280)
	at org.eclipse.hyades.test.ui.datapool.internal.control.DatapoolTable$4.handleEvent(DatapoolTable.java:1263)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1076)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
	at org.eclipse.swt.widgets.Widget.showMenu(Widget.java:1462)
	at org.eclipse.swt.widgets.Widget.wmContextMenu(Widget.java:1558)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5617)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4886)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2362)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:436)
	at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
	at org.eclipse.swt.widgets.Table.windowProc(Table.java:5691)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2459)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2601)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2565)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2399)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:669)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:662)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:599)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Comment 1 Paul Slauenwhite CLA 2010-05-14 13:59:16 EDT
In addition, the following inconsistencies exist when there are no records in the datapool:

-The cut/copy/paste context menus are enabled (header/rows)..
-The remove variable context menu on the header row does not automatically delete the column (header/rows).  Instead it opens the Delete Variable dialog (requires a name change to Remove Variable) with no variable selected.
-The insert record context menu is not enabled (header/rows).
-Inconsistencies when opening a datapool with no records compared to deleting all of the records.
Comment 2 Paul Slauenwhite CLA 2010-05-17 13:28:11 EDT
Created attachment 168768 [details]
Patch.
Comment 3 Paul Slauenwhite CLA 2010-05-17 13:29:12 EDT
Added a new test case to /org.eclipse.hyades.test.ui.datapool.tests/manual/datapool/Test.UI.DatapoolEditor_editing.testsuite.

The attached patch and test case are checked in to CVS (HEAD).
Comment 4 Paul Slauenwhite CLA 2010-06-23 14:39:48 EDT
Verified in TPTP-4.7.0RC4-201006081927.

Closing.