treeview - java treeviewer add element -


basically working treeviewer in java (org.eclipse.jface.viewers.treeviewer). problem is, want add childelement/ item existing knot.

first of tree looks this:

knot knot b knot c  >child1  >child2 

these children(child1, child2) arent added manually, generated before hands on tree itself.

  1. i create treeviewer: viewer = new treeviewer(parent, swt.multi | swt.h_scroll | swt.v_scroll);
  2. i populate treeviewer: viewer.setinput(....elements()); generates state above.

  3. viewer.gettree().getitem(0) returns correct knot of tree.

but cant add new child existing knot. tried following , other things:

treeitem newitem = new treeitem(items[0], swt.none); , viewer.add(items[0], newitem); newly created item viewer.refresh();

theoretically manipulate arraylist populates treeviewer in first place bad think.

i not know doing wrong right now. guess quite silly question. if case, sorry.^^

thank help, grateful every hint can offer.

updating 'model' (the data give setinput) correct way update tree. call treeviewer.refresh() or treeviewer.refresh(element) tree viewer update tree model.

when using treeviewer never create treeitem objects - viewer that. pass refresh, update, add ... methods objects model not treeitems.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -