public String getSelectedNodeStringifiedValue() {
    NoSqlTreeNode lastSelectedResultNode =
        (NoSqlTreeNode) resultTableView.getTree().getLastSelectedPathComponent();
    if (lastSelectedResultNode == null) {
      lastSelectedResultNode = (NoSqlTreeNode) resultTableView.getTree().getModel().getRoot();
    }
    NodeDescriptor userObject = lastSelectedResultNode.getDescriptor();
    if (userObject instanceof MongoResultDescriptor) {
      return stringifyResult(lastSelectedResultNode);
    }

    return userObject.toString();
  }
  public void updateResultTableTree(MongoResult mongoResult) {
    resultTableView =
        new JsonTreeTableView(
            JsonTreeModel.buildJsonTree(mongoResult), JsonTreeTableView.COLUMNS_FOR_READING);
    resultTableView.setName("resultTreeTable");

    resultTableView.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent mouseEvent) {
            if (mouseEvent.getClickCount() == 2 && MongoResultPanel.this.isSelectedNodeId()) {
              MongoResultPanel.this.editSelectedMongoDocument();
            }
          }
        });

    buildPopupMenu();

    resultTreePanel.invalidate();
    resultTreePanel.removeAll();
    resultTreePanel.add(new JBScrollPane(resultTableView));
    resultTreePanel.validate();
  }
  private DBObject getSelectedMongoDocument() {
    TreeTableTree tree = resultTableView.getTree();
    NoSqlTreeNode treeNode = (NoSqlTreeNode) tree.getLastSelectedPathComponent();
    if (treeNode == null) {
      return null;
    }

    NodeDescriptor descriptor = treeNode.getDescriptor();
    if (descriptor instanceof MongoKeyValueDescriptor) {
      MongoKeyValueDescriptor keyValueDescriptor = (MongoKeyValueDescriptor) descriptor;
      if (StringUtils.equals(keyValueDescriptor.getKey(), "_id")) {
        return mongoDocumentOperations.getMongoDocument(keyValueDescriptor.getValue());
      }
    }

    return null;
  }
  public boolean isSelectedNodeId() {
    if (resultTableView == null) {
      return false;
    }
    TreeTableTree tree = resultTableView.getTree();
    NoSqlTreeNode treeNode = (NoSqlTreeNode) tree.getLastSelectedPathComponent();
    if (treeNode == null) {
      return false;
    }

    NodeDescriptor descriptor = treeNode.getDescriptor();
    if (descriptor instanceof MongoKeyValueDescriptor) {
      MongoKeyValueDescriptor keyValueDescriptor = (MongoKeyValueDescriptor) descriptor;
      return StringUtils.equals(keyValueDescriptor.getKey(), "_id");
    }

    return false;
  }
 void collapseAll() {
   TreeTableTree tree = resultTableView.getTree();
   TreeUtil.collapseAll(tree, 1);
 }
 void expandAll() {
   TreeUtil.expandAll(resultTableView.getTree());
 }