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.compare.structuremergeviewer; 12 13 import org.eclipse.compare.ITypedElement; 14 15 /** 16 * An <code>IDiffElement</code> is used in the <code>DiffTreeViewer</code> 17 * to display the kind of change detected as the result of a two-way or three-way compare. 18 * <p> 19 * The base interface <code>ITypedElement</code> provides a name, a type, and an image. 20 * <code>IDiffElement</code> adds API for maintaining a parent relationship. 21 * <p> 22 * <code>DiffTreeViewer</code> works on a tree of <code>IDiffElements</code>. 23 * Leaf elements must implement the 24 * <code>IDiffElement</code> interface, inner nodes the <code>IDiffContainer</code> interface. 25 * <p> 26 * <code>IDiffElement</code>s are typically created as the result of performing 27 * a compare with the <code>Differencer</code>. 28 * <p> 29 * Clients may implement this interface, or use one of the standard implementations, 30 * <code>DiffElement</code>, <code>DiffContainer</code>, or <code>DiffNode</code>. 31 * 32 * @see DiffTreeViewer 33 * @see DiffElement 34 * @see DiffContainer 35 * @see DiffNode 36 */ 37 public interface IDiffElement extends ITypedElement { 38 39 /** 40 * Returns the kind of difference as defined in <code>Differencer</code>. 41 * 42 * @return the kind of difference as defined in <code>Differencer</code> 43 */ 44 int getKind(); 45 46 /** 47 * Returns the parent of this element. 48 * If the object is the root of a hierarchy <code>null</code> is returned. 49 * 50 * @return the parent of this element, or <code>null</code> if the element has no parent 51 */ 52 IDiffContainer getParent(); 53 54 /** 55 * Sets the parent of this element. 56 * 57 * @param parent the new parent of this element, or <code>null</code> if this 58 * element is to have no parent 59 */ 60 void setParent(IDiffContainer parent); 61 } 62