KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > core > diff > IDiffVisitor


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.team.core.diff;
12
13
14 /**
15  * An objects that visits diffs in a diff tree.
16  * <p>
17  * Usage:
18  * <pre>
19  * class Visitor implements IDiffVisitor {
20  * public boolean visit(IDiffNode diff) {
21  * switch (diff.getKind()) {
22  * case IResourceDelta.ADDED :
23  * // handle added resource
24  * break;
25  * case IResourceDelta.REMOVED :
26  * // handle removed resource
27  * break;
28  * case IResourceDelta.CHANGED :
29  * // handle changed resource
30  * break;
31  * }
32  * return true;
33  * }
34  * }
35  * IDiffTree tree = ...;
36  * tree.accept(new Visitor());
37  * </pre>
38  * </p>
39  * <p>
40  * Clients may implement this interface.
41  * </p>
42  * @see IDiffTree#accept(org.eclipse.core.runtime.IPath, IDiffVisitor, int)
43  *
44  * @since 3.2
45  */

46 public interface IDiffVisitor {
47
48     /**
49      * Visits the given diff.
50      * @param diff the diff being visited
51      * @return <code>true</code> if the diff's children should
52      * be visited; <code>false</code> if they should be skipped.
53      */

54     public boolean visit(IDiff diff);
55 }
56
Popular Tags