KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > dialogs > WorkingSetFilter


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  ******************************************************************************/

11
12 package org.eclipse.ui.internal.dialogs;
13
14 import java.util.Set JavaDoc;
15
16 import org.eclipse.jface.viewers.Viewer;
17 import org.eclipse.jface.viewers.ViewerFilter;
18 import org.eclipse.ui.IWorkingSet;
19
20 public class WorkingSetFilter extends ViewerFilter {
21         Set JavaDoc workingSetIds;
22         
23         public WorkingSetFilter(Set JavaDoc workingSetIds) {
24             this.workingSetIds = workingSetIds;
25         }
26         
27     public boolean select(Viewer viewer, Object JavaDoc parentElement, Object JavaDoc element) {
28         if (element instanceof IWorkingSet) {
29             IWorkingSet workingSet = (IWorkingSet) element;
30             String JavaDoc id = workingSet.getId();
31             //if (!workingSet.isVisible())
32
// return false;
33
if (workingSetIds != null && id != null) {
34                 return workingSetIds.contains(id);
35             }
36         }
37         return true;
38     }
39 }
Popular Tags