KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > viewers > AcceptAllFilter


1 /*******************************************************************************
2  * Copyright (c) 2004, 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 package org.eclipse.jface.viewers;
12
13
14 /**
15  * Filter that accepts everything. Available as a singleton since having
16  * more than one instance would be wasteful.
17  *
18  * @since 3.1
19  */

20 public final class AcceptAllFilter implements IFilter {
21
22     /**
23      * Returns the singleton instance of AcceptAllFilter
24      *
25      * @return the singleton instance of AcceptAllFilter
26      */

27     public static IFilter getInstance() {
28         return singleton;
29     }
30     
31     /**
32      * The singleton instance
33      */

34     private static IFilter singleton = new AcceptAllFilter();
35     
36     /* (non-Javadoc)
37      * @see org.eclipse.jface.viewers.deferred.IFilter#select(java.lang.Object)
38      */

39     public boolean select(Object JavaDoc toTest) {
40         return true;
41     }
42     
43     /* (non-Javadoc)
44      * @see java.lang.Object#equals(java.lang.Object)
45      */

46     public boolean equals(Object JavaDoc other) {
47         return other == this || other instanceof AcceptAllFilter;
48     }
49
50 }
51
Popular Tags