/* * JBoss, Home of Professional Open Source. * * See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. * * See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. */ package org.teiid.designer.ui.common.viewsupport; import java.io.File; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; /** * Filters out all {@link java.io.File}s that aren't directories. * @since 8.0 */ public class NonDirectoryFileViewerFilter extends ViewerFilter { /** * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) * @since 4.2 */ @Override public boolean select(Viewer theViewer, Object theParentElement, Object theElement) { boolean result = true; if (theElement instanceof File) { result = ((File)theElement).isDirectory(); } return result; } }