01: /*******************************************************************************
02: * Copyright (c) 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui.internal.dialogs;
11:
12: import java.util.Set;
13:
14: import org.eclipse.jface.viewers.Viewer;
15: import org.eclipse.jface.viewers.ViewerFilter;
16: import org.eclipse.ui.IWorkingSet;
17:
18: public class WorkingSetFilter extends ViewerFilter {
19: Set workingSetIds;
20:
21: public WorkingSetFilter(Set workingSetIds) {
22: this .workingSetIds = workingSetIds;
23: }
24:
25: public boolean select(Viewer viewer, Object parentElement,
26: Object element) {
27: if (element instanceof IWorkingSet) {
28: IWorkingSet workingSet = (IWorkingSet) element;
29: String id = workingSet.getId();
30: //if (!workingSet.isVisible())
31: // return false;
32: if (workingSetIds != null && id != null) {
33: return workingSetIds.contains(id);
34: }
35: }
36: return true;
37: }
38: }
|