Hi Christophe,
If you add a DefaultSelection listener to the tree then double-clicks will
no longer auto-expand/collapse its items. If there are some items that
should expand/collapse on double click and others that shouldn't then you
should add this listener and then invoke TreeItem.setExpanded(boolean) for
items that need it.
Grant
"Christophe Fondacci" <cfondacci@xxxxxxx> wrote in message
news:fhk6ck$2bh$1@xxxxxxxxxxxxxxxxxxxx
Hello,
On a basic SWT Tree widget, the default behaviour will automatically
expand
TreeItem when the user double clicks on it. My problem is : I have a
double
click listener and would like to allow TreeItem to expand or not
depending
on the selected item.
I tried adding a listener on the SWT.MouseDoubleClick event and then
controlling the Event.doit flag, but items are always expanding on double
clicks.
Actually, I would like the same behaviour as the "Package Explorer" view
of
Eclipse GUI :
When I double click on a java file, the file is opened in an editor and
the
item remains unexpanded
When I double click on a package, nothing is opened and the item is
expanded
by the double click action.
I would not like to control this behaviour by calling the setExpanded
method
on the TreeItem after the autoexpand, I would really like to control it
through events or properties.
Is there a simple way to do this ?
Thank you.
Christophe.