1 /******************************************************************************* 2 * Copyright (c) 2000, 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.IFileState; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.team.core.diff.IDiffTree; 16 import org.eclipse.team.core.diff.ITwoWayDiff; 17 import org.eclipse.team.core.history.IFileRevision; 18 19 /** 20 * A resource diff represents the changes between two resources. 21 * The diff can be used to describe the change between an ancestor and 22 * remote, an ancestor and local or between the local and a remote 23 * for two-way comparisons. 24 * <p> 25 * This interface is not intended to be implemented by clients. 26 * Clients that need to create deltas should instead use or subclass 27 * {@link org.eclipse.team.core.mapping.provider.ResourceDiff} 28 * </p> 29 * @see IDiffTree 30 * 31 * @since 3.2 32 */ 33 public interface IResourceDiff extends ITwoWayDiff { 34 35 /** 36 * Change constant (bit mask) indicating that the resource was opened or closed. 37 * For example, if the current state of the resource is open then 38 * it was previously closed. 39 * 40 * @see ITwoWayDiff#getFlags() 41 * @see org.eclipse.core.resources.IResourceDelta#OPEN 42 */ 43 public static final int OPEN = 0x10000; 44 45 /** 46 * Change constant (bit mask) indicating that a project's description has changed. 47 * 48 * @see ITwoWayDiff#getFlags() 49 * @see org.eclipse.core.resources.IResourceDelta#DESCRIPTION 50 */ 51 public static final int DESCRIPTION = 0x20000; 52 53 /** 54 * Return the local resource to which this diff applies. 55 * @return the local resource to which this diff applies 56 */ 57 public IResource getResource(); 58 59 /** 60 * Return a handle to the file state representing the "before" state 61 * of the file used to calculate this diff. A <code>null</code> is 62 * returned if the resource is not a file or if the file does not exist in 63 * the before state. If a file state is returned, clients should still 64 * check the {@link IFileState#exists()} method to see if the file 65 * existed in the before state. 66 * 67 * @return a handle to the file state representing the "before" state 68 * used to calculate this diff 69 */ 70 public IFileRevision getBeforeState(); 71 72 /** 73 * Return a handle to the file state representing the "after" state 74 * of the file used to calculate this diff. A <code>null</code> is 75 * returned if the resource is not a file or if the file does not exist in 76 * the after state. If a file state is returned, clients should still 77 * check the {@link IFileState#exists()} method to see if the file 78 * existed in the after state. 79 * 80 * @return a handle to the file state representing the "before" state 81 * used to calculate this diff 82 */ 83 public IFileRevision getAfterState(); 84 } 85