Bug 250569 - [Text] append() and insert() don't work inside VerifyText()
Summary: [Text] append() and insert() don't work inside VerifyText()
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-12 09:46 EDT by Leo K. CLA
Modified: 2009-07-06 02:59 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leo K. CLA 2008-10-12 09:46:14 EDT
Build ID: M20080911-1700

Steps To Reproduce:
1. Create a ViewPart with a org.eclipse.swt.widgets.Text widget:

public class View extends ViewPart implements VerifyListener{
	public static final String ID = "testinsert.view";

	private Text viewer;

	public void createPartControl(Composite parent) {
		viewer = new Text(parent, SWT.MULTI);
		viewer.addVerifyListener(this);
	}

	public void verifyText(VerifyEvent e) {
		System.err.println("e=->"+e.text+"<-");
		if (!e.text.contains("new text")){
			//System.err.println("appending new text");
			//viewer.setSelection(0);
			//viewer.insert("inserting new text\n");
			System.err.println("appending new text");
			viewer.append("new text\n");				
		}
	}
	public void setFocus() {
		viewer.setFocus();
	}
}

2. Start a RAP application showing this view.

3. Type "foo" slowly into the widget.
Stderr prints the folling lines, but no text except for the typed character is appended to the text widget:
e=->f<-
appending new text
e=->new text
<-
e=->fo<-
appending new text
e=->fnew text
<-
e=->foo<-
appending new text
e=->fonew text
<-

The same code can be tested in an RCP application and appends "new text" to the widget as expected.
Same problems are observed if the viewer.append() is replaced with viewer.setSelection() and viewer.insert() (see comments in the example above).

More information:
RAP Version tested is 1.1.1.20080917-1637

This bug may be related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=244008
but different VerifyEvent field meanings don't explain why Text.append() and Text.insert() don't work as expected.
Comment 1 Ivan Furnadjiev CLA 2008-10-13 03:45:35 EDT
I can confirm this. As a workaround you can append the text to e.text instead of Text widget.