/** * Returns whether the given element has children in the specified context. * Subclasses can override to be more efficient. * * @param element * @param context * @param monitor * @return */ protected boolean hasChildren(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException { return getChildCount(element, context, monitor) > 0; }
/** * Computes whether the given element is a container. * * @param parent potential parent * @param context presentation context * @param monitor result to report to */ protected void retrieveChildCount(IChildrenCountUpdate update) { if (!update.isCanceled()) { IStatus status = Status.OK_STATUS; try { IPresentationContext context = update.getPresentationContext(); if (supportsContext(context)) { int childCount = getChildCount( update.getElement(), context, update); if (!update.isCanceled()) { update.setChildCount(childCount); } } else { update.setChildCount(0); } } catch (CoreException e) { status = e.getStatus(); } update.setStatus(status); } }