private void getAllChildren(TreeNode<?> parent, List<TreeNode<?>> children) { List<TreeNode<?>> childrenForCurrentDeep = parent.getChildren(); if (childrenForCurrentDeep.isEmpty()) { return; } children.addAll(childrenForCurrentDeep); for (TreeNode<?> node : childrenForCurrentDeep) { getAllChildren(node, children); } }
/** {@inheritDoc} */ @Override public void onNodeExpanded(@NotNull final TreeNode<?> node) { if (node.getChildren().isEmpty()) { // If children is empty then node may be not refreshed yet? node.refreshChildren( new AsyncCallback<TreeNode<?>>() { @Override public void onSuccess(TreeNode<?> result) { if (node instanceof Openable) { ((Openable) node).open(); } if (!result.getChildren().isEmpty()) { updateNode(result); } } @Override public void onFailure(Throwable caught) { Log.error(ProjectExplorerPartPresenter.class, caught); } }); } }