private static @NotNull ArrayList<String> getGroupPath(final TreePath treePath, boolean includeSelf) {
    ArrayList<String> result = new ArrayList<>();
    int length = treePath.getPath().length - (includeSelf ? 0 : 1);
    for (int i = 0; i < length; i++) {
      Object o = ((DefaultMutableTreeNode)treePath.getPath()[i]).getUserObject();
      if (o instanceof Group) {
        result.add(((Group)o).getName());
      }
    }
    return result;
  }
private static @NotNull ArrayList<String> getGroupPath(final TreePath treePath, boolean includeSelf)