I have a problem with SWT Tree. My situation is like this: I have a SWT Tree, which contains many TreeItems (Log entries), which contain TreeItems too. Those log entries have really long messages, which could not be shown in the TreeColumns at all. So my idea was: adding a Listener to the tree, which opens a new Dialog by DoubleClick, which shows the entries' details. So far so good. If I do a double click on a item, it works. BUT: If I do a double click on a parent Item, it will expand (and thats good), but my double click Listener is active then as well and the Dialog will open. That's not, what I want.
So, there are two solutions to the problem: 1) prevent the Tree from expanding/collapsing by double click automatically and implement the method by myself or 2) recognize, that the item was expanded and the event has to be aborted.
I do not really know how to do 1 or 2. Do u guys know that?
Thanks in advance.
If you are using TreeViewer
, you could make use of IOpenListener
treeViewer.addOpenListener(new IOpenListener() {
@Override
public void open(OpenEvent event) {
}
}