| TreeViewer with multiple same objects,adds child to first occurence of its parent [message #905443] |
Thu, 30 August 2012 07:54  |
preeti baviskar Messages: 11 Registered: July 2012 |
Junior Member |
|
|
Hi,
I am using Tree with TreeViewer.
Tree treeSWComponent = new Tree(composite, SWT.BORDER);
TreeViewer tree_viewer=new TreeViewer(treeSWComponent);
When I am adding a child in the TreeViewer (on selection of Tree item),
tree_viewer.add(Object parent, Object child);
Since items in the Tree are repeated, TreeViewer contains multiple same objects so child is always adding to very first occurence of its parent.
Thanks.
|
|
|
|
|
|
| Re: TreeViewer with multiple same objects,adds child to first occurence of its parent [message #905874 is a reply to message #905815] |
Fri, 31 August 2012 04:41  |
Thorsten Schlathölter Messages: 179 Registered: February 2012 Location: Düsseldorf |
Senior Member |
|
|
I would suspect that there must be a difference between arg1(child) (occurence1) and arg1(child) (occurence2). Otherwise it wouldn't make sense to have two nodes. If you have two green boxes and you ask a friend to put the paper in the green box, then he will naturally ask - which one of the two green boxes. Of course you could also modify your model directly by adding the new node to the user selected arg1(child). But you must be aware that if your nodes are not distinct with respect to hashCode and equals, all viewer related tasks like adding a child, setting a path etc. will not work properly.
Regards,
Thorsten
|
|
|
Powered by
FUDForum. Page generated in 0.02398 seconds