1 /******************************************************************************* 2 * Copyright (c) 2000, 2005 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.text; 12 13 14 /** 15 * Implemented by tools supporting the editing process. 16 * <p> 17 * Clients may ask an <code>IEditingSupport</code> whether it is currently 18 * displaying a shell that has focus, and whether it is the origin of a document 19 * event. Depending on the answers to these queries, clients may decide to react 20 * differently to incoming notifications about events. For example, a special 21 * editing mode, that usually deactivates when the main shell looses focus, may 22 * decide to not deactivate if the focus event was triggered by an 23 * <code>IEditingSupport</code>. 24 * </p> 25 * <p> 26 * Clients may implement this interface. 27 * </p> 28 * 29 * @see IEditingSupportRegistry 30 * @since 3.1 31 */ 32 public interface IEditingSupport { 33 /** 34 * Returns <code>true</code> if the receiver is the originator of a 35 * <code>DocumentEvent</code> and if that <code>event</code> is related 36 * to <code>subjectRegion</code>. 37 * <p> 38 * The relationship between <code>event</code> and 39 * <code>subjectRegion</code> is not always obvious. Often, the main 40 * editing area being monitored by the caller will be at 41 * <code>subjectRegion</code>, when the receiver modifies the underlying 42 * document at a different location without wanting to interrupt the normal 43 * typing flow of the user. 44 * </p> 45 * <p> 46 * An example would be an editor that automatically increments the section 47 * number of the next section when the user typed in a new section title. In 48 * this example, the subject region is the current typing location, while 49 * the increment results in a document change further down in the text. 50 * </p> 51 * 52 * @param event the <code>DocumentEvent</code> in question 53 * @param subjectRegion the region that the caller is interested in 54 * @return <code>true</code> if <code>event</code> was triggered by the 55 * receiver and relates to <code>subjectRegion</code> 56 */ 57 boolean isOriginator(DocumentEvent event, IRegion subjectRegion); 58 59 /** 60 * Returns <code>true</code> if the receiver is showing a shell which has 61 * focus, <code>false</code> if it does not have focus or the helper has 62 * no shell. 63 * 64 * @return <code>true</code> if the support's shell has focus, 65 * <code>false</code> otherwise 66 */ 67 boolean ownsFocusShell(); 68 } 69