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

Bug 282624

Summary: Ampersand is doubled on Link.getText() when link widget is not visible
Product: [RT] RAP Reporter: Albina Pace <albina.pace>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: albina.pace, ivan, stefan.roeck
Version: 1.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Albina Pace CLA 2009-07-07 03:42:32 EDT
The ampersand (&) character is doubled when org.eclipse.swt.widgets.Link.getText() is called if the Link widget is not currently visible.

Steps to reproduce:
Use the following code which creates two tabs. The first tab contains link1, the second tab contains a button which displays link2 with the text of link1 when clicked.

Actual Results: link2 contains a doubled ampersand i.e. "Test with &&"

Expected Results: link2 contains "Test with &"

Code snippet:
TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
		tabFolder.setLayout(new GridLayout(1, false));
		tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		TabItem tab1 = new TabItem(tabFolder, SWT.NONE);
		tab1.setText("tab1");
		Composite container1 = new Composite(tabFolder, SWT.NONE);
		container1.setLayout(new GridLayout(1, false));
		container1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		tab1.setControl(container1);
		final Link link1 = new Link(container1, SWT.NONE);
		link1.setText("Test with &");
		TabItem tab2 = new TabItem(tabFolder, SWT.NONE);
		tab2.setText("tab2");
		Composite container2 = new Composite(tabFolder, SWT.NONE);
		container2.setLayout(new GridLayout(2, false));
		container2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		tab2.setControl(container2);
		final Link link2 = new Link(container2, SWT.NONE);
		Button button = new Button(container2, SWT.NONE);
		button.setText("press to set text");
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(final SelectionEvent e) {
				link2.setText(link1.getText());
			}
		});
Comment 1 Ivan Furnadjiev CLA 2009-07-07 04:16:36 EDT
This problem does not exist in the latest version from CVS HEAD. Link widget was completely reworked recently.
Comment 2 Stefan Röck CLA 2009-07-07 07:43:16 EDT
Ivan, does "recently" mean in 1.2 or in CVS Head? Thanks.
Comment 3 Ivan Furnadjiev CLA 2009-07-07 07:57:05 EDT
"Recently" means CVS HEAD :-), but the bug does not exist in 1.2 release too (just checked).
Comment 4 Ivan Furnadjiev CLA 2009-07-07 08:21:08 EDT
The snippet from the description works fine in 1.1.2 too.