KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > resources > IResourceProxyVisitor


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.core.resources;
12
13 import org.eclipse.core.runtime.CoreException;
14
15 /**
16  * This interface is implemented by objects that visit resource trees. The fast
17  * visitor is an optimized mechanism for tree traversal that creates a minimal
18  * number of objects. The visitor is provided with a callback interface,
19  * instead of a resource. Through the callback, the visitor can request
20  * information about the resource being visited.
21  * <p>
22  * Usage:
23  * <pre>
24  * class Visitor implements IResourceProxyVisitor {
25  * public boolean visit (IResourceProxy proxy) {
26  * // your code here
27  * return true;
28  * }
29  * }
30  * ResourcesPlugin.getWorkspace().getRoot().accept(new Visitor(), IResource.NONE);
31  * </pre>
32  * </p>
33  * <p>
34  * Clients may implement this interface.
35  * </p>
36  *
37  * @see IResource#accept(IResourceVisitor)
38  * @since 2.1
39  */

40 public interface IResourceProxyVisitor {
41     /**
42      * Visits the given resource.
43      *
44      * @param proxy for requesting information about the resource being visited;
45      * this object is only valid for the duration of the invocation of this
46      * method, and must not be used after this method has completed
47      * @return <code>true</code> if the resource's members should
48      * be visited; <code>false</code> if they should be skipped
49      * @exception CoreException if the visit fails for some reason.
50      */

51     public boolean visit(IResourceProxy proxy) throws CoreException;
52 }
53
Popular Tags