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. 17 * <p> 18 * Usage: 19 * <pre> 20 * class Visitor implements IResourceVisitor { 21 * public boolean visit(IResource res) { 22 * // your code here 23 * return true; 24 * } 25 * } 26 * IResource root = ...; 27 * root.accept(new Visitor()); 28 * </pre> 29 * </p> 30 * <p> 31 * Clients may implement this interface. 32 * </p> 33 * 34 * @see IResource#accept(IResourceVisitor) 35 */ 36 public interface IResourceVisitor { 37 /** 38 * Visits the given resource. 39 * 40 * @param resource the resource to visit 41 * @return <code>true</code> if the resource's members should 42 * be visited; <code>false</code> if they should be skipped 43 * @exception CoreException if the visit fails for some reason. 44 */ 45 public boolean visit(IResource resource) throws CoreException; 46 } 47