1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 IBM Corporation and others.
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.custom;
17 import org.eclipse.swt.internal.SWTEventListener;
20 * The StyledText widget implements this listener to receive
21 * notifications when changes to the model occur.
22 * It is not intended to be implemented by clients or by
23 * implementors of StyledTextContent.
24 * Clients should listen to the ModifyEvent or ExtendedModifyEvent
25 * that is sent by the StyledText widget to receive text change
27 * Implementors of StyledTextContent should call the textChanging
28 * and textChanged methods when text changes occur as described
29 * below. If the entire text is replaced the textSet method
30 * should be called instead.
32 public interface TextChangeListener extends SWTEventListener {
35 * This method is called when the content is about to be changed.
36 * Callers also need to call the textChanged method after the
37 * content change has been applied. The widget only updates the
38 * screen properly when it receives both events.
40 * @param event the text changing event. All event fields need
41 * to be set by the sender.
42 * @see TextChangingEvent
44 public void textChanging(TextChangingEvent event);
46 * This method is called when the content has changed.
47 * Callers need to have called the textChanging method prior to
48 * applying the content change and calling this method. The widget
49 * only updates the screen properly when it receives both events.
51 * @param event the text changed event
53 public void textChanged(TextChangedEvent event);
55 * This method is called instead of the textChanging/textChanged
56 * combination when the entire old content has been replaced
57 * (e.g., by a call to StyledTextContent.setText()).
59 * @param event the text changed event
61 public void textSet(TextChangedEvent event);