 
 fileprivate struct JumpBarControlBinding {
     fileprivate static var treeObserverContext = 1
-    fileprivate static var selectionObserverContext = 3
     fileprivate weak var treeController: NSTreeController?
-    fileprivate weak var selectionController: NSObject?
-    fileprivate var treeKeyPath: String
-    fileprivate var selectionKeyPath: String
-    
-    var selectedIndexPath: IndexPath? {
-        get { return self.selectionController?.value(forKey: self.selectionKeyPath) as! IndexPath? }
-    }
+    fileprivate var treeKeyPath: String    
 }
 
 open class JumpBarControl: NSControl, JumpBarSegmentControlDelegate {

                                    change: [NSKeyValueChangeKey : Any]?,
                                    context: UnsafeMutableRawPointer?)
    {
        guard context == &JumpBarControlBinding.treeObserverContext ||
            context == &JumpBarControlBinding.selectionObserverContext else
        {
            super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
            return
        }
        
        if context == &JumpBarControlBinding.treeObserverContext {
            self.useItemsTree(self.binding!.treeController!.arrangedRootObjects())
        }
        else if context == &JumpBarControlBinding.selectionObserverContext {
            if let indexPath = change?[NSKeyValueChangeKey.newKey] as? IndexPath {
                self.update(withIndexPath: indexPath)
            }
        }
    }

    open func useItemsTree(_ itemsTree: [JumpBarItem]) {
        self.segmentControls().forEach { $0.removeFromSuperview() }
        self.selectedIndexPath = nil

        // At that stage, we do items all in one shot. Might be optimized later.
        self.menu = NSMenu.menuWithSegmentsTree(itemsTree,
                                                target:self,
                                                action:#selector(JumpBarControl.select(itemFromMenuItem:)))
        
        self.layoutSegments()        
    }
    
    // MARK: - Selection

        }
        
        self.binding!.treeController?.removeObserver(self, forKeyPath: self.binding!.treeKeyPath)
        self.binding = nil
    }
    
