private void deleteDocument() {
		int option = JOptionPane.showConfirmDialog(parent, "Are you sure you want to delete the document?", "Delete document", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, UIUtils.icon("resources/large/document.png"));
		if (option == JOptionPane.YES_OPTION) {
			DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
			if (dmtn == null) {
				return;
			}
			TreeNode[] path = dmtn.getPath();
			if (path == null) {
				return;
			}
			if (path.length > 0) {
				DefaultMutableTreeNode root = (DefaultMutableTreeNode) path[1];
				if (root == null) {
					return;
				}
				CustomNode customNode = (CustomNode) root.getUserObject();
				MongoClient client = null;
				try {
					client = MongoUtils.getMongoClient(selectedCollection.getDatabase().getHost());
					client.getDB(selectedCollection.getDatabase().getName()).getCollection(selectedCollection.getName()).remove((DBObject) customNode.object);
					client.fsync(false);
					Runnable runnable = new Runnable() {
						@Override
						public void run() {
							find.setEnabled(false);
							handleQuery();
							find.setEnabled(true);
						}
					};
					es.submit(runnable);
				} catch (Exception e) {
					new ErrorDialog(parent, e);
				} finally {
					if (client != null) {
						client.close();
					}
				}
			}
		}
	}