Drawing Hands by M.C. Escher (1948)

Jeff Mesnil

Archive for April 18th, 2006


How to stop SWT Control traversal action

On April 18th, 2006 in eclipse (No Comments »)

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.