问题
I have used CheckboxTreeviewer with ICheckStateListener to get a checked elements. if element get checked then create a new set of object and setInut in same CheckboxTreeviewer.but when I put the new set of object in CheckboxTreeviewer previously checked elements unchecked.
code -
chboxtv.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
String child=null;
String parent=null;
Object obj= event.getElement();
if(obj instanceof Children){
Children child=(Children)changed;
childvalue=child.getChildren();
rootvalue=child.getParent();
List<Parent> pList=getResult(rootvalue,childvalue);
//Getting previously checked element.
Object [] chek= chboxtv.getCheckedElements(); chboxtv.setInput(pList);
chboxtv.expandToLevel(3);
chboxtv.setCheckedElements(chek);
}
}
});
In my condition always presents previously checked elements value in new set of object.
How to checked previously checked elements when new set of object load in CheckboxTreeviewer.
please see the Answer of this question
CheckboxTreeviewer previously set checked elements after reload
but still my problem is not solve. I am wasting two days on it.
How to achieve this?
来源:https://stackoverflow.com/questions/41267253/checkboxtreeviewer-set-old-checked-element-on-creating-new-set-of-objects