Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: dc6c5fbcc292d12ed381cc461672077d0a045ab2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.core.variants;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;

/**
 * A handle that provides access to locally cached resource variants that
 * represent a resource line-up such as a project version or branch.
 *
 * @see AbstractResourceVariantTree
 * @see ResourceVariantTree
 * @since 3.0
 * @noimplement This interface is not intended to be implemented by clients.
 *              However, clients may subclass
 *              {@link AbstractResourceVariantTree} or
 *              {@link ResourceVariantTree}.
 */
public interface IResourceVariantTree {

	/**
	 * Returns the list of root resources for which this tree may have resource
	 * variants.
	 * @return the list of root resources.
	 */
	public abstract IResource[] roots();

	/**
	 * Returns the members of the local resource that have resource variants in this tree.
	 * The members may or may not exist locally. The resource variants corresponding to the
	 * members can be retrieved using <code>getResourceVariant(IResource)</code>.
	 * @param resource the local resource
	 * @return the members of the local resource for which this tree contains resource variants
	 * @throws TeamException
	 */
	public abstract IResource[] members(IResource resource) throws TeamException;

	/**
	 * Return the resource variant corresponding to the local resource. Return
	 * <code>null</code> if there is no variant for the resource.
	 * @param resource the local resource
	 * @return the resource's variant in this tree
	 * @throws TeamException
	 */
	public abstract IResourceVariant getResourceVariant(IResource resource) throws TeamException;

	/**
	 * Return whether the local resource has a variant in this tree.
	 * @param resource the local resource
	 * @return <code>true</code> if the tree contains a variant for the resource
	 * @throws TeamException
	 */
	public boolean hasResourceVariant(IResource resource) throws TeamException;

	/**
	 * Refreshes the resource variant tree for the specified resources and possibly
	 * their descendants, depending on the depth.
	 * @param resources the resources whose variants should be refreshed
	 * @param depth the depth of the refresh (one of <code>IResource.DEPTH_ZERO</code>,
	 * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
	 * @param monitor a progress monitor
	 * @return the array of resources whose corresponding variants have changed
	 * as a result of the refresh
	 * @throws TeamException
	 */
	public IResource[] refresh(
			IResource[] resources,
			int depth,
			IProgressMonitor monitor) throws TeamException;

	/**
	 * Flush any variants in the tree for the given resource to the depth
	 * specified.
	 * @param resource the resource
	 * @param depth the flush depth (one of <code>IResource.DEPTH_ZERO</code>,
	 * <code>IResource.DEPTH_ONE</code>, or <code>IResource.DEPTH_INFINITE</code>)
	 * @throws TeamException
	 */
	public void flushVariants(IResource resource, int depth) throws TeamException;
}

Back to the top