Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » CheckedTreeSelectionDialog no children are return when trying to access treeviewer
CheckedTreeSelectionDialog no children are return when trying to access treeviewer [message #987912] Wed, 28 November 2012 11:00
Mat Mathiew is currently offline Mat Mathiew
Messages: 29
Registered: July 2012
Junior Member
I created a custom content provider tha implements ITreeContentProvider and my custom model similar to this: Vogella Tutorial JFace where it has Categories and Todos and Todos are stored as children of categories as a list in the class Category. I am using eclipse dialog CheckedTreeSelectionDialog and it should be the same as any tree dialog and I extended it to be able to get the checked elements in a map but for some reason i can get the treeitem of level1 but not their children and I cannot understand why.
    public void createMapOfCheckedItems() {
    mapOfCheckedElements = new HashMap<Object, List<Object>>();
    for (TreeItem level1 : getTreeViewer().getTree().getItems()) {
     if (level1.getChecked()) {
      List<Object> checkedChildren = new ArrayList<Object>();
      for (TreeItem level2 : level1.getItems()) {
                if (level2.getChecked()) {
                    checkedChildren.add(level2.getData());
                }
            }
            mapOfCheckedElements.put(level1.getData(), checkedChildren);
        }
    }
}

The code is the above but the level1.getItems() returns an empty treeitem but the selection dialog shows correctly the parents and childrens.
Previous Topic:JFace TableViewer/Table setitemcount() slow
Next Topic:CheckedTreeSelectionDialog no children are return when trying to access treeviewer
Goto Forum:
  


Current Time: Wed Jul 30 17:28:02 EDT 2014

Powered by FUDForum. Page generated in 0.02258 seconds