1 /******************************************************************************* 2 * Copyright (c) 2011 Wind River Systems and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * Wind River Systems - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.debug.internal.ui.viewers.model.provisional; 15 16 import org.eclipse.jface.viewers.ViewerFilter; 17 18 /** 19 * Viewer filter for the Tree Model Viewer which allows more efficient filtering 20 * in the lazy viewer. 21 * <p> 22 * The standard {@link ViewerFilter} class must be applied to all elements in the 23 * tree, thus forcing the lazy viewer to retrieve all children of all elements and 24 * defeating the lazy loading behavior. This class adds an {@link #isApplicable(ITreeModelViewer, Object)} 25 * method, which can be used by the filter to discern which parent elements the 26 * filter should apply to. 27 * </p> 28 * 29 * @since 3.8 30 */ 31 abstract public class TreeModelViewerFilter extends ViewerFilter { 32 33 /** 34 * Determines whether the filter applies to the given parent element. 35 * @return Returns true if the viewer should use the given filter on the 36 * given element. 37 * @param viewer The viewer that is using this filter to select elements. 38 * @param parentElement Parent element to check filter for. 39 */ isApplicable(ITreeModelViewer viewer, Object parentElement)40 abstract public boolean isApplicable(ITreeModelViewer viewer, Object parentElement); 41 } 42