@Nullable
 Tool getSingleSelectedTool() {
   final TreePath[] selectionPaths = myTree.getSelectionPaths();
   if (selectionPaths == null || selectionPaths.length != 1) {
     return null;
   }
   Object toolOrToolGroup =
       ((CheckedTreeNode) selectionPaths[0].getLastPathComponent()).getUserObject();
   if (toolOrToolGroup instanceof Tool) {
     return (Tool) toolOrToolGroup;
   }
   return null;
 }