Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Strang error with Nebula grid
Strang error with Nebula grid [message #1403524] Thu, 24 July 2014 09:48 Go to next message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
Hello,

i updated the Nebula grid componenta and realized a great speed improvement which is great.

However i got strange errors after a time if i add columns to my grid table.

The following error occurs occasionally:



java.lang.IndexOutOfBoundsException: Index: 14, Size: 13
at java.util.ArrayList.rangeCheckForAdd(ArrayList.java:646)
at java.util.ArrayList.add(ArrayList.java:458)
at org.eclipse.nebula.widgets.grid.GridItemDataVisualizer.addColumnToMap(GridItemDataVisualizer.java:388)
at org.eclipse.nebula.widgets.grid.GridItemDataVisualizer.addColumn(GridItemDataVisualizer.java:369)
at org.eclipse.nebula.widgets.grid.Grid.newColumn(Grid.java:7428)
at org.eclipse.nebula.widgets.grid.GridColumn.init(GridColumn.java:247)
at org.eclipse.nebula.widgets.grid.GridColumn.<init>(GridColumn.java:207)

at org.eclipse.jface.action.Action.runWithEvent(Action.java:519)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:462)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1122)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1006)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:147)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:630)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:574)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:133)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:103)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:378)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:232)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1462)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

!ENTRY org.eclipse.ui 4 0 2014-04-30 14:46:38.964
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
at org.eclipse.nebula.widgets.grid.internal.DefaultColumnHeaderRenderer.paint(DefaultColumnHeaderRenderer.java:116)
at org.eclipse.nebula.widgets.grid.Grid.paintHeader(Grid.java:5386)
at org.eclipse.nebula.widgets.grid.Grid.onPaint(Grid.java:4900)
at org.eclipse.nebula.widgets.grid.Grid.access$2(Grid.java:4880)
at org.eclipse.nebula.widgets.grid.Grid$4.paintControl(Grid.java:5969)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:230)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
at org.eclipse.swt.widgets.Composite.WM_PAINT(Composite.java:1491)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4667)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:339)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5020)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1122)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1006)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:147)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:630)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:574)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:133)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:103)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:378)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:232)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1462)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)



Is this a known bug? The grid library version i currently use was downloaded about 2 months ago (don't know the version number).

[Updated on: Thu, 24 July 2014 09:53]

Report message to a moderator

Re: Strang error with Nebula grid [message #1403542 is a reply to message #1403524] Thu, 24 July 2014 10:29 Go to previous messageGo to next message
Mirko Paturzo is currently offline Mirko PaturzoFriend
Messages: 4
Registered: May 2014
Junior Member
Hi Marcel,
No, this one is not a known bug. Could you open a bug in bugzilla?
I also need a snippet that replicates the error.

Thanks a lot
Mirko
Re: Strang error with Nebula grid [message #1403543 is a reply to message #1403524] Thu, 24 July 2014 10:31 Go to previous messageGo to next message
Mirko Paturzo is currently offline Mirko PaturzoFriend
Messages: 4
Registered: May 2014
Junior Member
Hi Marcel,

No, this one is not a known bug. Could you open a bug in bugzilla?
I also need a snippet that replicates the error.

Thanks a lot
Mirko
Re: Strang error with Nebula grid [message #1403663 is a reply to message #1403543] Fri, 25 July 2014 06:31 Go to previous messageGo to next message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
Hello Mirko,

thanks i will open a bug when i can reproduce it with a sample snippet. Until know i see this error in my application.
Re: Strang error with Nebula grid [message #1403682 is a reply to message #1403543] Fri, 25 July 2014 09:45 Go to previous messageGo to next message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
Hello Mirko,

before i file a bug here an easy example. The eventually bug was hard to reproduce.

Please select the last column (or the column before) and insert a column at the selection. The application will crash.

Select the first or second column and everything will work fine.

Alter the source and remove the text from the grid (remove all gridItem.setText... )all selections will work fine.

So it seems that it has something to do with the text in a grid item.

Source to reproduce:


import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridColumn;
import org.eclipse.nebula.widgets.grid.GridEditor;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class TestGrid {

	private static Grid grid;

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());

		
		shell.setSize(800, 518);

		Composite composite = new Composite(shell, SWT.NONE);
		composite.setLayout(null);

		Button btnNewButton = new Button(composite, SWT.NONE);
		btnNewButton.setBounds(640, 0, 144, 66);
		btnNewButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {

				Point[] sel = grid.getCellSelection();

				if (sel.length == 0) {

					GridColumn column = new GridColumn(grid, SWT.NONE, grid
							.getColumnCount());
					column.setWidth(50);

				} else {
					System.out.println("Columns: "+grid.getColumnCount()+" Selected Column: "+sel[0].x);
					GridColumn column = new GridColumn(grid, SWT.NONE, sel[0].x);

					column.setWidth(50);

				}

			}
		});
		btnNewButton.setText("Add Column");

		grid = new Grid(composite, SWT.BORDER);
		grid.setBounds(0, 0, 622, 456);
		grid.setHeaderVisible(true);
		// Show row header
		grid.setRowHeaderVisible(true);
		// Enable cell selection
		grid.setRowsResizeable(true);
		grid.setCellSelectionEnabled(true);

		GridColumn gridColumn = new GridColumn(grid, SWT.NONE);
		gridColumn.setText("C1");
		gridColumn.setWidth(50);

		GridColumn gridColumn_1 = new GridColumn(grid, SWT.NONE);
		gridColumn_1.setText("C2");
		gridColumn_1.setWidth(50);

		GridColumn gridColumn_2 = new GridColumn(grid, SWT.NONE);
		gridColumn_2.setText("C3");
		gridColumn_2.setWidth(50);

		GridColumn gridColumn_3 = new GridColumn(grid, SWT.NONE);
		gridColumn_3.setText("C4");
		gridColumn_3.setWidth(50);

		final GridEditor editor = new GridEditor(grid);
		
		GridItem gridItem = new GridItem(grid, SWT.NONE);
		gridItem.setText("With Text");
		
		GridItem gridItem_1 = new GridItem(grid, SWT.NONE);
		gridItem_1.setText("With Text");
		
		GridItem gridItem_2 = new GridItem(grid, SWT.NONE);
		gridItem_2.setText("With Text");
		editor.horizontalAlignment = SWT.LEFT;
		editor.grabHorizontal = true;
		

		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}


Re: Strang error with Nebula grid [message #1403846 is a reply to message #1403524] Mon, 28 July 2014 09:21 Go to previous messageGo to next message
Mirko Paturzo is currently offline Mirko PaturzoFriend
Messages: 4
Registered: May 2014
Junior Member
Hi Marcel,

Using this snippet i have reproduced the bug.
Thanks for reply.
Don't worry for bug opening. I'm working on it.

Mirko

[Updated on: Mon, 28 July 2014 09:21]

Report message to a moderator

Re: Strang error with Nebula grid [message #1403848 is a reply to message #1403846] Mon, 28 July 2014 09:32 Go to previous messageGo to next message
Mirko Paturzo is currently offline Mirko PaturzoFriend
Messages: 4
Registered: May 2014
Junior Member
Bug opened.. See: https://bugs.eclipse.org/bugs/show_bug.cgi?id=440519
icon14.gif  Re: Strang error with Nebula grid [message #1404028 is a reply to message #1403848] Tue, 29 July 2014 08:53 Go to previous message
Marcel Austenfeld is currently offline Marcel AustenfeldFriend
Messages: 160
Registered: July 2009
Senior Member
Hello Mirko,

thanks. I made some successful tests. Everything seems to be working.

Great.
Previous Topic:Problems using CDateTimeCellEditor
Next Topic:Whether modify the row number for other string(NatTable)
Goto Forum:
  


Current Time: Sat Apr 20 01:44:21 GMT 2024

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

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

Back to the top