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.internal; 12 13 import org.eclipse.swt.widgets.Composite; 14 15 import org.eclipse.jface.viewers.Viewer; 16 import org.eclipse.compare.CompareConfiguration; 17 18 /** 19 * A factory object for creating a <code>Viewer</code>s from a descriptor. 20 * <p> 21 * It is used when registering a viewer for a specific type 22 * in <code>CompareUIPlugin.registerContentViewerDescriptor</code> and 23 * in <code>CompareUIPlugin.registerStructureViewerDescriptor</code>. 24 * 25 * @see org.eclipse.compare.structuremergeviewer.IStructureCreator 26 * @see CompareUIPlugin 27 */ 28 public interface IViewerDescriptor { 29 30 /** 31 * Creates a new viewer from this descriptor under the given STW parent control. 32 * If the current viewer has the same type as a new viewer 33 * the implementation of this method is free to return the current viewer instead. 34 * 35 * @param currentViewer the current viewer which is going to be replaced with a new viewer. 36 * @param parent the SWT parent control under which the new viewer has to be created. 37 * @param config a compare configuration the new viewer might be interested in. 38 * @return a new viewer or the current viewer. 39 */ 40 Viewer createViewer(Viewer currentViewer, Composite parent, CompareConfiguration config); 41 } 42