[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Overriding double-click auto expand on TreeItem

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.