public <T> List<T> getSelectedElements(Class<? extends T> elementClass) {
    final TreePath[] paths = getSelectionPaths();
    if (paths == null) {
      return Collections.emptyList();
    }
    final ArrayList<T> result = new ArrayList<>(paths.length);
    for (TreePath path : paths) {
      final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
      Object userObject = node.getUserObject();
      if (userObject instanceof NodeDescriptor && elementClass.isInstance(((NodeDescriptor<?>) userObject).getElement())) {
        //noinspection unchecked
        result.add((T)((NodeDescriptor<?>) node.getUserObject()).getElement());
      }
    }
    return result;
  }
public <T> List<T> getSelectedElements(Class<? extends T> elementClass)