Skip to main content


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 16:00
Mat Mathiew is currently offline Mat MathiewFriend
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:[Data Binding] Binding depends on another binding
Next Topic:CheckedTreeSelectionDialog no children are return when trying to access treeviewer
Goto Forum:
  


Current Time: Tue Mar 19 06:15:52 GMT 2024

Powered by FUDForum. Page generated in 0.02503 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top