KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > events > DeltaFilter


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

11 package org.eclipse.core.internal.events;
12
13 import org.eclipse.core.internal.watson.IDeltaFilter;
14 import org.eclipse.core.resources.IResourceDelta;
15
16 public class DeltaFilter implements IDeltaFilter {
17     protected int mask;
18
19     public DeltaFilter(int mask) {
20         super();
21         this.mask = mask;
22     }
23
24     public boolean includeElement(int flags) {
25         /**
26          * There are two conditions for accepting a flag: 1) The flags and the mask
27          * have at least one bit in common, 2) The flags is zero, and the
28          * mask specifies to include changed children. The only reason
29          * the flags can be zero is if there are changed children, in which
30          * case we want to treat it as a change.
31          */

32         if (flags == 0)
33             flags = IResourceDelta.CHANGED;
34         return (flags & mask) != 0;
35     }
36 }
Popular Tags