001 /*
002 * file NonEmptyFolderFilter.java
003 *
004 * Licensed Materials - Property of IBM
005 * Restricted Materials of IBM - you are allowed to copy, modify and
006 * redistribute this file as part of any program that interfaces with
007 * IBM Rational CM API.
008 *
009 * com.ibm.rational.teamapi.scout.NonEmptyFolderFilter
010 *
011 * © Copyright IBM Corporation 2005, 2008. All Rights Reserved.
012 * Note to U.S. Government Users Restricted Rights: Use, duplication or
013 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
014 */
015 package com.ibm.rational.teamapi.scout;
016
017 import org.eclipse.jface.viewers.Viewer;
018 import org.eclipse.jface.viewers.ViewerFilter;
019
020 /**
021 * A ViewFilter that allows only folders with real content to be displayed.
022 * That is, it suppresses the display of empty folders.
023 */
024 public class NonEmptyFolderFilter extends ViewerFilter {
025
026 /*
027 * @see ViewerFilter#select(Viewer, Object, Object)
028 */
029 public boolean select(Viewer viewer, Object parentElement, Object element) {
030 return !((ProxyElement)element).isEmptyFolder();
031 }
032 }