org.eclipse.team.core/src/org/eclipse/team/core/diff/IDiffTree.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (download) (annotate)
Wed Jun 4 15:59:35 2008 UTC (17 months, 3 weeks ago) by tzarna
Branch: MAIN
CVS Tags: I20080604, I20080605, I20090323-1100, I20081202, I20090306-1030, I20090311-0800, I20080819, I20091006-0800, I20090427-0800, I20091013-0800, I20090407-0800, I20090721-0750, I20090803-1300, r34x_20080827, I20090630-2000, I20090224-0800, I20091028-0800, r34x_20080115, I20090331-0800, I20090929-0800, I20080803, I20090303-0800, I20080804, r34x_20090115, I20090825-0800, I20081014, r34x_20080107, I20090514-0808, I20090126-0800, R3_4, R3_5, I20080715, I20090714-0800, r34x_20080808, I20090521-1750, I20090522-1010, I20081021, I20090922-0800, r34x_20080723, I20090113, I20080820, I20080722, I20080826, I20090309-1300, I20090421, I20090916-0800, I20090428, I20090211, I20090106, I20080923, R3_5_1, I20090429-0800, I20091124-0800, I20090210-0800, I20081029, I20090309-1800, I20081125, I20090527-0620, I20091020-0800, I20080930, I20090217-0800, I20091117-0800, I20081216, I20081210, r34x_20081015, I20081118, I20090508-2000, r34x_20080902, I20090120, r35x_20090930-0800, I20090511-2000, I20090128-0800, I20080909, I20091026-1300, R3_4_2, R3_4_1, v20090210-0615, I20090430-0408, I20080915, I20080917, I20090317-1800, HEAD
Branch point for: R3_4_maintenance, R3_5_maintenance
Changes since 1.16: +8 -8 lines
bug 234375: Additional adopting of API Tooling by Team/Core
/*******************************************************************************
 * Copyright (c) 2000, 2008 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.core.diff;

import org.eclipse.core.runtime.*;

/**
 * A diff tree provides access to a tree of {@link IDiff} instances. For
 * efficiency reasons, the tree only provides diffs for paths that represent a
 * change. Paths that do not contain a diff represent but are returned from the
 * tree will contain child paths in the set.
 * 
 * @see org.eclipse.team.core.diff.provider.DiffTree
 * @since 3.2
 * @noimplement This interface is not intended to be implemented by clients.
 *              Clients should use
 *              {@link org.eclipse.team.core.diff.provider.DiffTree} instead.
 */
public interface IDiffTree {
	
	/**
	 * Property constant used to indicate that a particular path may be involved in an operation.
	 */
	public static final int P_BUSY_HINT = 1;
	
	/**
	 * Property constant used to indicate that a particular path has descendants that are conflicts.
	 */
	public static final int P_HAS_DESCENDANT_CONFLICTS = 2;

	/**
	 * Add a listener to the tree. The listener will be informed of any changes
	 * in the tree. Registering a listener that is already registered will have
	 * no effects.
	 * 
	 * @param listener the listener to be added
	 */
	public void addDiffChangeListener(IDiffChangeListener listener);

	/**
	 * Remove the listener from the tree. Removing a listener that is not
	 * registered has no effect.
	 * 
	 * @param listener the listener to be removed
	 */
	public void removeDiffChangeListener(IDiffChangeListener listener);

	/**
	 * Accepts the given visitor. The only kinds of deltas visited are
	 * <code>ADDED</code>, <code>REMOVED</code>, and <code>CHANGED</code>.
	 * The visitor's <code>visit</code> method is called with the given delta
	 * if applicable. If the visitor returns <code>true</code>, any of the
	 * delta's children in this tree are also visited.
	 * 
	 * @param path the path to start the visit in the tree
	 * @param visitor the visitor
	 * @param depth the depth to visit
	 * @see IDiffVisitor#visit(IDiff)
	 */
	public void accept(IPath path, IDiffVisitor visitor, int depth);

	/**
	 * Returns the delta identified by the given path,
	 * or <code>null</code> if there is no delta at that path. The supplied path
	 * may be absolute or relative; in either case, it is interpreted as
	 * relative to the workspace. Trailing separators are ignored.
	 * <p>
	 * This method only returns a delta if there is a change at the given
	 * path. To know if there are deltas in descendent paths, clients
	 * should class {@link #getChildren(IPath) }.
	 * 
	 * @param path the path of the desired delta
	 * @return the delta, or <code>null</code> if no such
	 *         delta exists
	 */
	public IDiff getDiff(IPath path);

	/**
	 * Returns the child paths of the given path that either point to
	 * a sync delta or have a descendant path that points to a sync delta.
	 * Returns an empty array if there are no sync deltas that are descendents
	 * of the given path.
	 * 
	 * @return the child paths of the given path that either point to
	 * a sync delta or have a descendant path that points to a sync delta
	 */
	public IPath[] getChildren(IPath parent);

	/**
	 * Return the number of diffs contained in the tree.
	 * @return the number of diffs contained in the tree
	 */
	public int size();
	
	/**
	 * Return whether the set is empty.
	 * @return whether the set is empty
	 */
	public boolean isEmpty();
	
	/**
	 * Return the number of out-of-sync elements in the given set whose synchronization
	 * state matches the given mask. A state of 0 assumes a count of all changes.
	 * A mask of 0 assumes a direct match of the given state.
	 * <p>
	 * For example, this will return the number of outgoing changes in the set:
	 * <pre>
	 *  long outgoing =  countFor(IThreeWayDiff.OUTGOING, IThreeWayDiff.DIRECTION_MASK);
	 * </pre>
	 * </p>
	 * @param state the sync state
	 * @param mask the sync state mask
	 * @return the number of matching resources in the set.
	 */
	public long countFor(int state, int mask);
	
	/**
	 * Set the given diff nodes and all their parents to busy
	 * @param diffs the busy diffs
	 * @param monitor a progress monitor or <code>null</code> if progress indication 
	 * is not required
	 */
	public void setBusy(IDiff[] diffs, IProgressMonitor monitor);
	
	/**
	 * Return the value of the property for the given path.
	 * @param path the path
	 * @param property the property
	 * @return the value of the property
	 */
	public boolean getProperty(IPath path, int property);

	
	/**
	 * Clear all busy properties in this tree.
	 * @param monitor a progress monitor or <code>null</code> if progress indication 
	 * is not required
	 */
	public void clearBusy(IProgressMonitor monitor);
	
	/**
	 * Return whether the this diff tree contains any diffs that match the given filter
	 * at of below the given path.
	 * @param path the path
	 * @param filter the diff node filter
	 * @return whether the given diff tree contains any deltas that match the given filter
	 */
	public boolean hasMatchingDiffs(IPath path, final FastDiffFilter filter);

}