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

Bug 334117

Summary: [menu] Popup menu that is set in multiple controls causes Javascript error
Product: [RT] RAP Reporter: Rüdiger Herrmann <ruediger.herrmann>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: rsternberg
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Rüdiger Herrmann CLA 2011-01-12 10:13:21 EST
The following snippet (SWT Snippet #40) causes a Javascript error:
	Display display = new Display ();
	Shell shell = new Shell (display);
	shell.setLayout(new GridLayout(2, false));
	Composite c1 = new Composite (shell, SWT.BORDER);
	c1.setLayoutData(new GridData(100, 100));
	Composite c2 = new Composite (shell, SWT.BORDER);
	c2.setLayoutData(new GridData(100, 100));
	Menu menu = new Menu (shell, SWT.POP_UP);
	MenuItem item = new MenuItem (menu, SWT.PUSH);
	item.setText ("Popup");
	c1.setMenu (menu);
	c2.setMenu (menu);
	shell.setMenu (menu);
	shell.setSize (300, 300);
	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}

The error message is:
Error: Error: Error in property contextMenu of class org.eclipse.swt.widgets.Shell in method setContextMenu with incoming value 'undefined': Undefined value is not allowed!

Reproducible in IE 8, Firefox, Chrome
Comment 1 Rüdiger Herrmann CLA 2011-01-12 10:39:23 EST
Here is another SWT Snippet (#89)  that causes the same error:

	Display display = new Display ();
	Shell shell = new Shell (display);
	Menu menu = new Menu (shell, SWT.POP_UP);
	for (int i=0; i<4; i++) {
		MenuItem item = new MenuItem (menu, SWT.RADIO);
		item.setText ("Item " + i);
	}
	shell.setMenu (menu);
	shell.setSize (300, 300);
	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
Comment 2 Ivan Furnadjiev CLA 2011-01-12 10:49:11 EST
I think that this is duplicate of bug 223879.
Comment 3 Rüdiger Herrmann CLA 2011-01-12 10:59:38 EST
You are right, Ivan. This is a duplicate of bug 223879. Sorry for the noise.

*** This bug has been marked as a duplicate of bug 223879 ***
Comment 4 Ralf Sternberg CLA 2011-01-12 16:48:52 EST
(In reply to comment #0)
> The error message is:
> Error: Error: Error in property contextMenu of class

Anyways, I'd suggest to redesign the error message to start with:

Error! Error! Error! ;-)