/**
   * Get the children of the specified container. If the container is lazy and dirty the returned
   * array will contain only one element, i.e. a {@link ProgressRunner} that is used to monitor the
   * progress of the children fetching operation that will be started immediately by this method.
   *
   * @param container The container from which to fetch the children.
   * @return An array containing either the list of children or a {@link ProgressRunner} object.
   */
  protected Object[] getChildren(final IGridContainer container) {

    Object[] children = null;

    if (container.isLazy() && container.isDirty()) {

      ProgressTreeNode monitor = this.progressNodes.get(container);

      if (monitor == null) {

        FetchChildrenJob fetcher =
            new FetchChildrenJob(container, this.treeViewer.getControl().getShell());
        monitor = new ProgressTreeNode(this.treeViewer);
        this.progressNodes.put(container, monitor);
        fetcher.setExternalMonitor(monitor);
        fetcher.setSystem(true);
        fetcher.schedule();
      }

      children = new Object[] {monitor};

    } else {

      this.progressNodes.remove(container);

      try {
        IGridElement[] childElements = container.getChildren(null);
        List<IGridElement> visibleChildren = new ArrayList<IGridElement>();
        for (IGridElement child : childElements) {
          if (!child.isHidden()) {
            visibleChildren.add(child);
          }
        }
        children = visibleChildren.toArray(new IGridElement[visibleChildren.size()]);
      } catch (ProblemException pExc) {
        if (this.treeViewer != null) {
          Shell shell = this.treeViewer.getControl().getShell();
          ProblemDialog.openProblem(
              shell,
              Messages.getString("GridModelContentProvider.problem_title"), // $NON-NLS-1$
              Messages.getString("GridModelContentProvider.problem_text")
                  + container.getName(), // $NON-NLS-1$
              pExc);
        } else {
          Activator.logException(pExc);
        }
      }
    }

    return children;
  }
 @Override
 public boolean canContain(final IGridElement element) {
   return IGridApplication.class.isAssignableFrom(element.getClass())
       || ContainerMarker.class.isAssignableFrom(element.getClass());
 }