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

Bug 280409

Summary: [Design] View action throws NullPointerException when there is no handler
Product: [RT] RAP Reporter: Hasan Ceylan <hceylan>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: sr121
Attachments:
Description Flags
NullpointerException Handling
none
HandlerService Solution none

Description Hasan Ceylan CLA 2009-06-16 04:20:49 EDT
+++ This bug was initially created as a clone of Bug #279132 +++

Toolbars' actions are correctly displayed with the solution in the bug report above.

However, when there's dynamic handlers that become available based on the expression settings in the plugins.xml, the action has null handler.

Here's the stack trace when the handler is null...

Hasan
Comment 1 Hasan Ceylan CLA 2009-06-16 04:20:58 EDT
for some reason handler is null for the action.

Here's the stack trace. Action is declared using the plugin.xml and made
available based on "selection" and "instance of" expressions...

Hasan 

java.lang.NullPointerException
        at
org.eclipse.rap.internal.design.example.business.managers.BusinessCoolBarManager$6.widgetSelected(BusinessCoolBarManager.java:691)
        at
org.eclipse.swt.events.SelectionEvent.dispatchToObserver(SelectionEvent.java:176)
        at org.eclipse.rwt.internal.events.Event.processEvent(Event.java:44)
        at org.eclipse.swt.events.TypedEvent.processEvent(TypedEvent.java:125)
        at org.eclipse.swt.events.TypedEvent.executeNext(TypedEvent.java:165)
        at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.readAndDispatch(RWTLifeCycle.java:244)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:764)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2485)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2444)
        at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2295)
        at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:514)
        at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:497)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
        at com.turquality.server.rap.Application.createUI(Application.java:58)
        at
org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
        at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:231)
        at
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:119)
        at java.lang.Thread.run(Thread.java:636)
Comment 2 Holger Staudacher CLA 2009-06-18 08:20:08 EDT
Created attachment 139536 [details]
NullpointerException Handling

The attached solution should fix this Error. Can you verify this Hasan?
Comment 3 Hasan Ceylan CLA 2009-06-18 10:17:19 EDT
Nope,

Solves the null pointer exception but the problem here is the handler is always null. Normally it should update based on the selection...

As you may already know, handlers are dynamic and assigned to their respective commands based on contextual changes in the workbench, like selection...

Hasan
Comment 4 Holger Staudacher CLA 2009-06-18 10:49:59 EDT
Created attachment 139549 [details]
HandlerService Solution

Hi Hasan,
I was on the wrong trail. Now it uses the HandlerService to execute commands, this should listen to selection changes and so on. Can you verify this, just check out the new attachment.
Comment 5 Holger Staudacher CLA 2009-07-20 16:32:18 EDT
Committed to CVS HEAD and 1.2 maintenance.