private void setSubtreeChecked(Object parent, boolean state, boolean checkExpandedState) {
    if (!(parent instanceof IAdaptable)) return;
    IContainer container = (IContainer) ((IAdaptable) parent).getAdapter(IContainer.class);
    if ((!fTree.getExpandedState(parent) && checkExpandedState)
        || (container != null && !container.isAccessible())) return;

    Object[] children = fTreeContentProvider.getChildren(parent);
    for (int i = children.length - 1; i >= 0; i--) {
      Object element = children[i];
      if (state) {
        fTree.setChecked(element, true);
        fTree.setGrayed(element, false);
      } else fTree.setGrayChecked(element, false);
      if (isExpandable(element)) setSubtreeChecked(element, state, true);
    }
  }
 private void handleContainerSelection(final Object object) {
   IContainer container = (IContainer) object;
   try {
     if (container.isAccessible()) {
       IResource[] resources = container.members();
       for (int i = 0; i < resources.length; i++) {
         IResource resource = resources[i];
         String resourceName = resource.getName();
         boolean hasWarProductExtension =
             resourceName.endsWith("." + WARProductConstants.FILE_EXTENSION); // $NON-NLS-1$
         if (resource instanceof IFile && hasWarProductExtension) {
           IFile file = (IFile) resource;
           loadProductFromFile(file);
         }
       }
     }
   } catch (final CoreException e) {
     MessageDialog.openError(getShell(), Messages.LoadWARProductError, e.getMessage());
   }
 }