Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » NPE at editor opening from toolbar
NPE at editor opening from toolbar [message #1148378] Mon, 21 October 2013 09:07 Go to next message
Esteban Dugueperoux is currently offline Esteban Dugueperoux
Messages: 289
Registered: July 2009
Senior Member
Hi JFace/SWT developers,

We have an Eclipse based application for which we have editors
displaying tree using TreeViewer. These editors can be opened from a
resource in the workspace or from an action of the toolbar. But since
Kepler SR1 when one of these editors is opened from the toolbar we get
the following NPE :

java.lang.NullPointerException
at
org.eclipse.jface.viewers.TreeViewerFocusCellManager.getInitialFocusCell(TreeViewerFocusCellManager.java:122)
at
org.eclipse.jface.viewers.SWTFocusCellManager.handleFocusIn(SWTFocusCellManager.java:133)
at
org.eclipse.jface.viewers.SWTFocusCellManager.access$3(SWTFocusCellManager.java:131)
at
org.eclipse.jface.viewers.SWTFocusCellManager$2.handleEvent(SWTFocusCellManager.java:154)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1397)
at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:3839)
at org.eclipse.swt.widgets.Control.gtk_event_after(Control.java:3119)
at org.eclipse.swt.widgets.Tree.gtk_event_after(Tree.java:1928)
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2085)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:5467)
at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:3557)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4569)
at org.eclipse.swt.internal.gtk.OS._gtk_widget_grab_focus(Native Method)
at org.eclipse.swt.internal.gtk.OS.gtk_widget_grab_focus(OS.java:13756)
at org.eclipse.swt.widgets.Control.forceFocus(Control.java:2438)
at org.eclipse.swt.widgets.Composite.forceFocus(Composite.java:546)
at org.eclipse.swt.widgets.Control.forceFocus(Control.java:2431)
at org.eclipse.swt.widgets.Control.setFocus(Control.java:4284)
at org.eclipse.swt.widgets.Composite.setFocus(Composite.java:1410)
at test.PlopEditor.setFocus(PlopEditor.java:110)
at
org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.delegateSetFocus(CompatibilityPart.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at
org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
at
org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:249)
at
org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:220)
at
org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:107)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.focusGui(PartRenderingEngine.java:763)
at
org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:597)
at
org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:544)
at
org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:533)
at
org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3120)
at org.eclipse.ui.internal.WorkbenchPage.access$21(WorkbenchPage.java:3034)
at org.eclipse.ui.internal.WorkbenchPage$8.run(WorkbenchPage.java:3016)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:3012)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2976)
at
org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2959)
at test.Defaulthandler.execute(Defaulthandler.java:20)
at
org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
at
org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at
org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at
org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
at
org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
at
org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at
org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at
org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at
org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at
org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850)
at
org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743)
at
org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727)
at
org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3742)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3363)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
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:354)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

These are the steps to reproduce :

1. Using the "Test" plugin project in attachment launch a kelper runtime
2. Create a project named "Test" containing a file named "My.ecore"
3. Click on the toolbar action named "PlopLabel"

This is a regression from Kepler. On which bugzilla component I must
raise a issue? Against JFace or SWT component?

Best Regards.
  • Attachment: Test.zip
    (Size: 8.08KB, Downloaded 30 times)
Re: NPE at editor opening from toolbar [message #1202629 is a reply to message #1148378] Fri, 22 November 2013 03:33 Go to previous messageGo to next message
Michal Borek is currently offline Michal Borek
Messages: 25
Registered: August 2010
Junior Member
Hello,
Have you found the reason of such behavior?

I have similar problem and I wonder why...


Re: NPE at editor opening from toolbar [message #1211009 is a reply to message #1202629] Tue, 26 November 2013 03:05 Go to previous messageGo to next message
Thorsten Schlathölter is currently offline Thorsten Schlathölter
Messages: 208
Registered: February 2012
Location: Düsseldorf
Senior Member
Just for the records: if I run an eclipse application with the above plugin, the plip-plap-plop editor opens without any issue.

I am using: Eclispe 4.3.1 M20130911-1000

Regards
Thorsten
Re: NPE at editor opening from toolbar [message #1220334 is a reply to message #1211009] Wed, 11 December 2013 02:54 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent Redor
Messages: 20
Registered: July 2009
Junior Member
Hello,

Thorsten, are you on Windows or on Linux?
This problem is perhaps only on Linux.

Regards,

Laurent
Re: NPE at editor opening from toolbar [message #1220344 is a reply to message #1220334] Wed, 11 December 2013 03:36 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent Redor
Messages: 20
Registered: July 2009
Junior Member
OK, sorry, I do not reproduce the problem either with the reproduction case of Esteban. For your information, I work with Esteban. We have this problem on JUnit tests but we can not send it in current state.

I will try to analyze the stack to get a reproduction case that allows to reproduce the problem systematically.
Re: NPE at editor opening from toolbar [message #1220363 is a reply to message #1220344] Wed, 11 December 2013 05:19 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent Redor
Messages: 20
Registered: July 2009
Junior Member
I finally managed to reproduce the problem with the use case.

But I completed the scenario :
* Take a fresh install of Eclipse Modeling Kepler SR1 (eclipse-modeling-kepler-SR1-linux-gtk-x86_64 for me)
* Import the "Test" plugin in your workspace (from Test.zip)
* Launch a runtime
* Create a simple Project ("MyProject")
* Create an ecore model in the new Project (My.ecore)
* Close the automatically opened editor
* Click on the toolbar action named "PlopLabel"
* In the error log, there is an error corresponding to the NPE (Error setting focus to : org.eclipse.e4.ui.model.application.ui.basic.impl.PartImpl PlopEditor)

In this case, there is no "topItem" so on line 122 of org.eclipse.jface.viewers.TreeViewerFocusCellManager in method getInitialFocusCell, the tree.getTopItem().isDisposed() throws a NPE.

I don't understand why. If you just click on the toolbar action named "PlopLabel" without creating the project and the ecore file, there is no problem.
Re: NPE at editor opening from toolbar [message #1229389 is a reply to message #1220363] Thu, 09 January 2014 05:46 Go to previous message
Maxime Porhel is currently offline Maxime Porhel
Messages: 68
Registered: July 2009
Member
Hi Laurent,

With eclipse-modeling-kepler-SR1-win32 and Windows 8 and your scenario, I do not have the issue.
Previous Topic:ComboBoxCellEditor trims text when style is set to SWT.BORDER | SWT.READ_ONLY
Next Topic:Data binding of dates and times
Goto Forum:
  


Current Time: Wed Jul 23 06:05:06 EDT 2014

Powered by FUDForum. Page generated in 0.11120 seconds