Jeff Mesnil
Weblog · About

How to stop SWT Control traversal action

April 18, 2006

Another ah-ha moment with Eclipse...

It is quite simple but I stumble upon it before finding how in Eclipse you can stop the traversal of SWT Control from a TraverseListener implementation.

In your listener, handle the TraverseEvent event and then just

event.doit = false;

and the system will stop traversing the Controls.

Everything is well explained in TraverseEvent javadoc (but I'm guilty of not reading javadoc until I need it...). The explanation is worth a read and shows how powerful traversal can be in eclipse using both TraverseEvent detail and doit fields.