Leung Wang Hei
Leung Wang Hei

Reputation: 67

Double click event for TreeViewer column header?

All I would like to do is to add double-click-to-sort at a JFace TreeViewer column. I could find the question asked in Eclipse forum since May 2010 but no response so far.

So far I have tried:

column.addListener(SWT.MouseDoubleClick, listener);  // Not working, listener never called

treeViewer.addDoubleClickListener(new IDoubleClickListener();  // Work in the item, not column header

Am I missing something?

Any advice is apprecated.

Hei

Upvotes: 1

Views: 1732

Answers (1)

Frettman
Frettman

Reputation: 2271

The last time I checked this was still not possible with SWT 3.7. Like the documentation states, TreeColumns and TableColumns only send Move, Resize and Selection events. Plus, column headers can now (well, since 3.5 or so) display the control's context menu. But there's nothing to detect a double click on a column header.

Since you seem to need this for sorting, does it have to be a double click? The Selection event (i.e. single click) of a column is the common way to do that.

Upvotes: 1

Related Questions