Community
Participate
Working Groups
Hi, In my application, I have a validation going on where I validate against a database. To not do that on every ModifyEvent I registered a PostSelectionListener to my TextViewer. Everything seems to work except for one thing which I think should be working too: If you modify the text and the previous and future text are not of equal length, a SelectionEvent is fired. However if you remove 1 character and add 1 character right away there is no even fired for that. So doing this quickly: 1234 // 1st input 123 // 2nd input 1235 // 3rd input will not fire a selection event even though selection has changed. Is this behavior intended? If it is, can I work around that or do I have to implement my own PostSelectionListener for the TextViewer's modify event? Kind regards, -- Artur
This works as designed: the post selection listener fires if the selection changed after the given delay. If the selection is the same, then nothing happens. It looks like what you want is to trigger the work after the text has been changed but not on each keystroke. To do that you should use a reconciler. See org.eclipse.jface.text.source.SourceViewerConfiguration.getReconciler(ISourceViewer) for details. You might also want to look at: http://www.eclipse.org/eclipse/platform-text/eclipseCon/2006/texteditorrecipes.zip