1 /******************************************************************************* 2 * Copyright (c) 2000, 2007 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.jface.viewers; 12 13 /** 14 * A listener which is notified of significant events in the 15 * life of a cell editor. 16 * <p> 17 * This interface should be implemented by classes that wish to 18 * react to cell editor activity. 19 * </p> 20 * <p> 21 * Note: the cell editor is not passed as a parameter to any 22 * of these methods; so the assumption is that the listener 23 * knows which cell editor is talking to it. 24 * </p> 25 */ 26 public interface ICellEditorListener { 27 /** 28 * Notifies that the end user has requested applying a value. 29 * All cell editors send this notification. 30 * <p> 31 * The normal reaction is to update the model with the current cell editor value. 32 * However, if the value is not valid, it should not be applied. 33 * A typical text-based cell editor would send this message 34 * when the end user hits Return, whereas other editors would 35 * send it whenever their value changes. 36 * </p> 37 */ 38 public void applyEditorValue(); 39 40 /** 41 * Notifies that the end user has canceled editing. 42 * All cell editors send this notification. 43 * A listener should <b>not</b> update the model based on this 44 * notification; see <code>applyEditorValue</code>. 45 */ 46 public void cancelEditor(); 47 48 /** 49 * Notifies that the end user is changing the value in the cell editor. This 50 * notification is normally sent only by text-based editors in response to a 51 * keystroke, so that the listener may show an error message reflecting the 52 * current valid state. This notification is sent while the value is being 53 * actively edited, before the value is applied or canceled. A listener should 54 * <b>not</b> update the model based on this notification; see 55 * <code>applyEditorValue</code>. 56 * <p> 57 * If the <code>newValidState</code> parameter is <code>true</code>, 58 * the new value may be retrieved by calling <code>ICellEditor.getValue</code> 59 * on the appropriate cell editor. 60 * </p> 61 * 62 * @param oldValidState the valid state before the end user changed the value 63 * @param newValidState the current valid state 64 */ 65 public void editorValueChanged(boolean oldValidState, boolean newValidState); 66 } 67