1 /******************************************************************************* 2 * Copyright (c) 2005, 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.history; 12 13 import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy; 14 import org.eclipse.ltk.core.refactoring.history.RefactoringHistory; 15 16 import org.eclipse.swt.widgets.Control; 17 18 import org.eclipse.jface.viewers.ICheckStateListener; 19 import org.eclipse.jface.viewers.ISelectionChangedListener; 20 21 import org.eclipse.ltk.ui.refactoring.RefactoringUI; 22 23 /** 24 * Control which is capable of displaying parts of a refactoring history. 25 * <p> 26 * Clients of this interface should call <code>createControl</code> before 27 * calling <code>setInput</code>. 28 * </p> 29 * <p> 30 * An instanceof of a refactoring history control may be obtained by calling 31 * {@link RefactoringUI#createRefactoringHistoryControl(org.eclipse.swt.widgets.Composite, RefactoringHistoryControlConfiguration)}. 32 * </p> 33 * <p> 34 * Note: this interface is not intended to be implemented by clients. 35 * </p> 36 * 37 * @see RefactoringHistoryControlConfiguration 38 * @see RefactoringHistoryContentProvider 39 * @see RefactoringHistoryLabelProvider 40 * 41 * @since 3.2 42 */ 43 public interface IRefactoringHistoryControl { 44 45 /** 46 * Registers the specified check state listener with this control. 47 * <p> 48 * If the listener is already registered with the control, or the control 49 * has no checkable viewer or has not yet been created, nothing happens. 50 * </p> 51 * 52 * @param listener 53 * the listener to register 54 */ 55 public void addCheckStateListener(ICheckStateListener listener); 56 57 /** 58 * Registers the specified selection changed listener with this control. 59 * <p> 60 * If the listener is already registered with the control or has not yet 61 * been created, nothing happens. 62 * </p> 63 * 64 * @param listener 65 * the listener to register 66 */ 67 public void addSelectionChangedListener(ISelectionChangedListener listener); 68 69 /** 70 * Creates the refactoring history control. 71 * <p> 72 * This method creates the necessary widgets and initializes the refactoring 73 * history control. It is called only once. Method <code>getControl()</code> 74 * should be used to retrieve the widget hierarchy. 75 * </p> 76 * 77 * @see #getControl() 78 */ 79 public void createControl(); 80 81 /** 82 * Returns the checked refactoring descriptors. 83 * <p> 84 * In case the refactoring history control is created with a non-checkable 85 * tree viewer, this method is equivalent to 86 * {@link #getSelectedDescriptors()}. 87 * </p> 88 * 89 * @return the selected refactoring descriptors, or an empty array. 90 * 91 * @see IRefactoringHistoryControl#getSelectedDescriptors() 92 * @see RefactoringHistoryControlConfiguration#isCheckableViewer() 93 */ 94 public RefactoringDescriptorProxy[] getCheckedDescriptors(); 95 96 /** 97 * Returns the SWT control of this refactoring history control. 98 * 99 * @return the SWT control, or <code>null</code> if the control's widget 100 * hierarchy has not yet been created 101 */ 102 public Control getControl(); 103 104 /** 105 * Returns the selected refactoring descriptors. 106 * 107 * @return the selected refactoring descriptors, or an empty array. 108 */ 109 public RefactoringDescriptorProxy[] getSelectedDescriptors(); 110 111 /** 112 * Unregisters the specified check state listener with this control. 113 * <p> 114 * If the listener is not registered with this control, nothing happens. 115 * </p> 116 * 117 * @param listener 118 * the listener to unregister 119 */ 120 public void removeCheckStateListener(ICheckStateListener listener); 121 122 /** 123 * Unregisters the specified selection changed listener with this control. 124 * <p> 125 * If the listener is not registered with this control, nothing happens. 126 * </p> 127 * 128 * @param listener 129 * the listener to unregister 130 */ 131 public void removeSelectionChangedListener(ISelectionChangedListener listener); 132 133 /** 134 * Sets the checked refactoring descriptors. 135 * <p> 136 * In case the refactoring history control is created with a non-checkable 137 * tree viewer, this method is equivalent to 138 * {@link #setSelectedDescriptors(RefactoringDescriptorProxy[])}. 139 * </p> 140 * 141 * @param descriptors 142 * the refactoring descriptors to check, or an empty array 143 * 144 * @see IRefactoringHistoryControl#setSelectedDescriptors(RefactoringDescriptorProxy[]) 145 * @see RefactoringHistoryControlConfiguration#isCheckableViewer() 146 */ 147 public void setCheckedDescriptors(RefactoringDescriptorProxy[] descriptors); 148 149 /** 150 * Sets the refactoring history of this control. 151 * 152 * @param history 153 * the refactoring history, or <code>null</code> to clear the 154 * viewer input 155 */ 156 public void setInput(RefactoringHistory history); 157 158 /** 159 * Sets the selected refactoring descriptors. 160 * 161 * @param descriptors 162 * the refactoring descriptors to select, or an empty array 163 */ 164 public void setSelectedDescriptors(RefactoringDescriptorProxy[] descriptors); 165 } 166