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.ltk.ui.refactoring; 12 13 import org.eclipse.swt.widgets.Composite; 14 import org.eclipse.swt.widgets.Control; 15 16 /** 17 * Viewer to present the preview for a {@link org.eclipse.ltk.core.refactoring.Change}. 18 * <p> 19 * Viewers are associated with a change object via the extension point <code> 20 * org.eclipse.ltk.ui.refactoring.changePreviewViewers</code>. Implementors of this 21 * extension point must therefore implement this interface. 22 * </p> 23 * <p> 24 * To ensure visual consistency across all provided preview viewers the widget 25 * hierarchy provided through the method {@link #createControl(Composite)} has to 26 * use a {@link org.eclipse.swt.custom.ViewForm} as its root widget. 27 * </p> 28 * <p> 29 * Clients of this interface should call <code>createControl</code> before calling 30 * <code>setInput</code>. 31 * </p> 32 * 33 * @since 3.0 34 */ 35 public interface IChangePreviewViewer { 36 37 /** 38 * Creates the preview viewer's widget hierarchy. This method 39 * is only called once. Method <code>getControl()</code> 40 * should be used to retrieve the widget hierarchy. 41 * 42 * @param parent the parent for the widget hierarchy 43 * 44 * @see #getControl() 45 */ 46 public void createControl(Composite parent); 47 48 /** 49 * Returns the preview viewer's SWT control. 50 * 51 * @return the preview viewer's SWT control or <code>null</code> 52 * is the widget hierarchy hasn't been created yet 53 */ 54 public Control getControl(); 55 56 /** 57 * Sets the preview viewer's input element. 58 * 59 * @param input the input element 60 */ 61 public void setInput(ChangePreviewViewerInput input); 62 } 63 64