Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Using a different configuration gives a NullPointerException
Using a different configuration gives a NullPointerException [message #893687] Thu, 05 July 2012 09:29 Go to next message
Renso Lohuis is currently offline Renso LohuisFriend
Messages: 44
Registered: July 2012
Member
I am just using NatTable and I like it so far. I am working through the tutorials and I get an null pointer exception when I use a different configuration (autoconfigure = false).

I even used the default table (example) the reproduce the problem:

natTable = new NatTable(parent, false);
natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
natTable.configure();


When I use that the content in the body is not being displayed. If I click on a table cell in the body I get the following NullPointerException:

java.lang.NullPointerException
	at net.sourceforge.nattable.ui.matcher.CellPainterMouseEventMatcher.matches(CellPainterMouseEventMatcher.java:45)
	at net.sourceforge.nattable.ui.binding.UiBindingRegistry.getDragMode(UiBindingRegistry.java:47)
	at net.sourceforge.nattable.ui.mode.ConfigurableModeEventHandler.mouseDown(ConfigurableModeEventHandler.java:49)
	at net.sourceforge.nattable.ui.mode.ModeSupport.mouseDown(ModeSupport.java:85)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:192)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1022)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:916)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:150)
	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:353)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1414)


The parent is an org.eclipse.swt.widgets.Composite.
I am building an Eclipse E4 RCP application.

Does anybody know what is wrong?
Can it have something to do with Eclipse E4 RCP?

[Updated on: Thu, 05 July 2012 09:41]

Report message to a moderator

Re: Using a different configuration gives a NullPointerException [message #893732 is a reply to message #893687] Thu, 05 July 2012 11:45 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 1405
Registered: July 2012
Senior Member
Hi,

if you create a NatTable instance with autoconfigure = false you have to ensure that the base configuration for rendering the NatTable is added manually (maybe customized).

A simple way to solve your issue is to add the default configuration like NatTable does on autoconfigure.

natTable = new NatTable(parent, false);
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
natTable.addConfiguration(new HeaderMenuConfiguration(natTable));
natTable.configure();


Greez,
Dirk
Re: Using a different configuration gives a NullPointerException [message #893736 is a reply to message #893732] Thu, 05 July 2012 12:22 Go to previous message
Renso Lohuis is currently offline Renso LohuisFriend
Messages: 44
Registered: July 2012
Member
That's it. It works now!

Thank you Dirk!

I guess I found an old example which doesn't work in the latest version of NatTable.
Previous Topic:Select column upon RMB click
Next Topic:Tutorials and Examples
Goto Forum:
  


Current Time: Fri Nov 21 18:01:44 GMT 2014

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

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