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

Bug 294178

Summary: Javascript Error if a Button is pressed twice
Product: [RT] RAP Reporter: Ralf Heydenreich <rheydenr>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: 1.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 263048    
Bug Blocks:    
Attachments:
Description Flags
Project file for test none

Description Ralf Heydenreich CLA 2009-11-04 05:24:55 EST
Created attachment 151278 [details]
Project file for test

I made a simple HelloWorld Plugin which only displays a simple View. Then I
created a class which displays a text field and a button. If you press the
button, a new list field opens and you can select one ore more values. On focus
lost the selected values are copied into the text field. The first time this
works correct. But if you press the button for the second time, the following
error message appears:

Could not evaluate javascript response:

'w' ist Null oder kein Objekt

org.eclipse.swt.EventUtil.suspendEventHandling();var req =
org.eclipse.swt.Request.getInstance();req.setRequestCounter( "10" );var wm =
org.eclipse.swt.WidgetManager.getInstance();var w = wm.findWidgetById( "w5"
);w.setSpace( 254, 112, -90, 110 );w.setActive( true );var w = wm.newWidget(
"w55", "w5", true, null, "org.eclipse.swt.widgets.List" );w.init( true
);w.addState( "rwt_BORDER" );w.setOverflow( "auto" );w.setSpace( 0, 0, 0, 0
);w.setZIndex( 300 );w.setTabIndex( 1 );w.addEventListener( "focusin",
org.eclipse.swt.EventUtil.focusGained );w.addEventListener( "focusout",
org.eclipse.swt.EventUtil.focusLost );w.setItems( [ "Broccoli", "Bundt Cake",
"Cabbage", "Candy Canes", "Eggs", "Potato Chips", "Milk", "Soda", "Chicken",
"Cinnamon Rolls" ] );w.selectItems( [1,2,3 ] );w.focusItem( 1
);w.setChangeSelectionNotification( "action" );var w = wm.findWidgetById( "w5"
);w.setActiveControl( wm.findWidgetById( "w55" )
);org.eclipse.swt.WidgetManager.getInstance().focus( "w55"
);qx.ui.core.Widget.flushGlobalQueues();org.eclipse.swt.EventUtil.resumeEventHandling();

Perhaps I used something in the wrong way. The version of RAP with which I've
tested is 1.2.0 and 1.2.1. Please see the attached project file.
Comment 1 Ivan Furnadjiev CLA 2009-11-04 06:48:14 EST
Ralf, in your example the popup shell is created only once in the constructor. Closing the shell will dispose it. The second time when you try to open the shell again, it is already disposed. To workaround this, create a new shell if it is disposed.
In current CVS HEAD (1.3M3) we introduced WidgetDisposed check - see bug 263048. Your snippet throws exception (org.eclipse.swt.SWTException: Widget is disposed) in this case.
Comment 2 Ralf Heydenreich CLA 2009-11-04 09:00:28 EST
Thanks a lot. I think this solves the problem. I didn't see any exception and therefore didn't know where to search for errors.
Comment 3 Ralf Heydenreich CLA 2009-11-04 09:01:59 EST
After resolving Bug 263048 this Bug can be closed.
Comment 4 Ralf Heydenreich CLA 2009-11-04 09:03:44 EST
Since Bug 263048 was resolved this Bug can be marked as resolved, too.