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

Bug 456418

Summary: [Form Dialog] Widget Disposed Exception on Text on Form Dialog if enter key pressed
Product: [RT] RAP Reporter: Setya Nugdjaja <jsetya>
Component: JFaceAssignee: Project Inbox <rap-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3    
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Setya Nugdjaja CLA 2014-12-31 09:05:07 EST
Hi RAP Team,

We constantly have 'Widget is disposed' exception with the following snippet:

private void buildContent(final Shell parent, final FormToolkit toolkit)
{
	parent.setLayout(GridLayoutFactory.fillDefaults().create());
	
	Button button = toolkit.createButton(parent, "Click Me", SWT.PUSH);
	button.setLayoutData(GridDataFactory.swtDefaults().hint(150, SWT.DEFAULT).create());
	
	button.addSelectionListener
	(
		new SelectionAdapter()
		{
			private static final long serialVersionUID = -4588567910050872119L;

			@Override
			public void widgetSelected(SelectionEvent e)
			{
				FormDialog dialog = new FormDialog(parent)
				{
					private static final long serialVersionUID = 1L;

					@Override
					protected void createFormContent(IManagedForm managedForm)
					{
						Composite parent = managedForm.getForm().getBody();
						parent.setLayout(GridLayoutFactory.fillDefaults().create());
						
						Composite composite = toolkit.createComposite(parent);
						composite.setLayout(GridLayoutFactory.fillDefaults().create());
						composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
						
						PageBook pageBook = new PageBook(composite, SWT.NONE);
						pageBook.setLayout(GridLayoutFactory.fillDefaults().create());
						pageBook.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
				                toolkit.adapt(pageBook, true, true);

						Composite page = toolkit.createComposite(pageBook);
						page.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
						page.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

						Text text = toolkit.createText(page, null);
						text.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
						
						pageBook.showPage(page);
					}
				};
				
				dialog.open();
			}
		}
	);
}

Step to reproduce:

1. Click the button.
2. Set focus on the Text on the Dialog.
3. Press enter.

Any help would be greatly appreciated.

Thanks & Regards,
Setya
Comment 1 Ivan Furnadjiev CLA 2014-12-31 11:57:44 EST
.

*** This bug has been marked as a duplicate of bug 449350 ***