1 /******************************************************************************* 2 * Copyright (c) 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.mapping; 12 13 import org.eclipse.core.resources.mapping.ResourceMapping; 14 import org.eclipse.core.resources.mapping.ResourceTraversal; 15 import org.eclipse.core.runtime.CoreException; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager; 18 19 /** 20 * A scope manager is responsible for ensuring that the resources 21 * contained within an {@link ISynchronizationScope} stay up-to-date 22 * with the model elements (represented as {@link ResourceMapping} instances) 23 * contained in the scope. The task of keeping a scope up-to-date is 24 * accomplished by obtaining {@link ISynchronizationScopeParticipant} instances 25 * for each model that has elements contained in the scope. 26 * 27 * <p> 28 * This interface is not intended to be implemented by clients. Clients can instead 29 * subclass {@link SynchronizationScopeManager}. 30 * 31 * @see org.eclipse.core.resources.mapping.ResourceMapping 32 * @see SynchronizationScopeManager 33 * @see ISynchronizationScopeParticipant 34 * 35 * @since 3.2 36 */ 37 public interface ISynchronizationScopeManager { 38 39 /** 40 * Return the scope that is managed by this manager. 41 * @return the scope that is managed by this manager 42 */ 43 ISynchronizationScope getScope(); 44 45 /** 46 * Return whether the scope has been initialized. 47 * @return whether the scope has been initialized. 48 */ 49 boolean isInitialized(); 50 51 /** 52 * Build the scope that is used to determine the complete set of resource 53 * mappings, and hence resources, that an operation should be performed on. 54 * <p> 55 * This method obtains a lock on the workspace root to avoid workspace 56 * changes while calculating the scope. 57 * @param monitor a progress monitor 58 * when building the scope 59 * 60 * @throws CoreException 61 */ 62 void initialize(IProgressMonitor monitor) throws CoreException; 63 64 /** 65 * Refresh the scope of this manager for the given mappings. 66 * Changes in the scope will be reported as a property change 67 * event fired from the scope. Clients should call this method 68 * when a change in the workspace or a change issued from this 69 * manager have resulted in a change in the resources that 70 * should be included in the scope. 71 * @param mappings the mappings to be refreshed 72 * @param monitor a progress monitor 73 * @return a set of traversals that cover the given mappings 74 * @throws CoreException 75 */ 76 ResourceTraversal[] refresh(ResourceMapping[] mappings, IProgressMonitor monitor) throws CoreException; 77 78 /** 79 * Method to be invoked when the scope of this 80 * manager is no longer needed. It is typically the 81 * responsibility of the client that creates a scope manager 82 * to dispose of it. 83 */ 84 void dispose(); 85 86 } 87