@Nullable
 private TreePath getSelectedUniquePath() {
   JTree tree = getTree();
   if (tree == null) return null;
   TreePath[] paths = tree.getSelectionPaths();
   return paths == null || paths.length != 1 ? null : paths[0];
 }
 @Nullable
 private List<UsageInfo> getSelectedUsageInfos() {
   TreePath[] paths = myTree.getSelectionPaths();
   if (paths == null) return null;
   final ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();
   for (TreePath path : paths) {
     SliceNode sliceNode = fromPath(path);
     if (sliceNode != null) {
       result.add(sliceNode.getValue().getUsageInfo());
     }
   }
   if (result.isEmpty()) return null;
   return result;
 }
  @Nullable
  private Node[] getSelectedNodes() {
    TreePath[] leadSelectionPath = myTree.getSelectionPaths();
    if (leadSelectionPath == null || leadSelectionPath.length == 0) return null;

    final List<Node> result = new ArrayList<Node>();
    for (TreePath comp : leadSelectionPath) {
      final Object lastPathComponent = comp.getLastPathComponent();
      if (lastPathComponent instanceof Node) {
        final Node node = (Node) lastPathComponent;
        result.add(node);
      }
    }
    return result.isEmpty() ? null : result.toArray(new Node[result.size()]);
  }
  @Override
  @Nullable
  public Set<Usage> getSelectedUsages() {
    TreePath[] selectionPaths = myTree.getSelectionPaths();
    if (selectionPaths == null) {
      return null;
    }

    Set<Usage> usages = new THashSet<Usage>();
    for (TreePath selectionPath : selectionPaths) {
      DefaultMutableTreeNode node = (DefaultMutableTreeNode) selectionPath.getLastPathComponent();
      collectUsages(node, usages);
    }

    return usages;
  }
 @NotNull
 private List<Navigatable> getNavigatables() {
   TreePath[] paths = myTree.getSelectionPaths();
   if (paths == null) return Collections.emptyList();
   final ArrayList<Navigatable> navigatables = new ArrayList<Navigatable>();
   for (TreePath path : paths) {
     Object lastPathComponent = path.getLastPathComponent();
     if (lastPathComponent instanceof DefaultMutableTreeNode) {
       DefaultMutableTreeNode node = (DefaultMutableTreeNode) lastPathComponent;
       Object userObject = node.getUserObject();
       if (userObject instanceof Navigatable) {
         navigatables.add((Navigatable) userObject);
       } else if (node instanceof Navigatable) {
         navigatables.add((Navigatable) node);
       }
     }
   }
   return navigatables;
 }
  @Nullable
  private UsageTarget[] getSelectedUsageTargets() {
    TreePath[] selectionPaths = myTree.getSelectionPaths();
    if (selectionPaths == null) return null;

    Set<UsageTarget> targets = new THashSet<UsageTarget>();
    for (TreePath selectionPath : selectionPaths) {
      Object lastPathComponent = selectionPath.getLastPathComponent();
      if (lastPathComponent instanceof UsageTargetNode) {
        UsageTargetNode usageTargetNode = (UsageTargetNode) lastPathComponent;
        UsageTarget target = usageTargetNode.getTarget();
        if (target != null && target.isValid()) {
          targets.add(target);
        }
      }
    }

    return targets.isEmpty() ? null : targets.toArray(new UsageTarget[targets.size()]);
  }
 @Nullable
 private Object[] getSelectedTreeElements() {
   final JTree tree = getTree();
   return tree != null ? convertPathsToTreeElements(tree.getSelectionPaths()) : null;
 }
 private Object[] getSelectedElements() {
   final JTree tree = getTree();
   return tree != null
       ? convertPathsToValues(tree.getSelectionPaths())
       : ArrayUtil.EMPTY_OBJECT_ARRAY;
 }