01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jface.text;
11:
12: /**
13: * Implemented by tools supporting the editing process.
14: * <p>
15: * Clients may ask an <code>IEditingSupport</code> whether it is currently
16: * displaying a shell that has focus, and whether it is the origin of a document
17: * event. Depending on the answers to these queries, clients may decide to react
18: * differently to incoming notifications about events. For example, a special
19: * editing mode, that usually deactivates when the main shell looses focus, may
20: * decide to not deactivate if the focus event was triggered by an
21: * <code>IEditingSupport</code>.
22: * </p>
23: * <p>
24: * Clients may implement this interface.
25: * </p>
26: *
27: * @see IEditingSupportRegistry
28: * @since 3.1
29: */
30: public interface IEditingSupport {
31: /**
32: * Returns <code>true</code> if the receiver is the originator of a
33: * <code>DocumentEvent</code> and if that <code>event</code> is related
34: * to <code>subjectRegion</code>.
35: * <p>
36: * The relationship between <code>event</code> and
37: * <code>subjectRegion</code> is not always obvious. Often, the main
38: * editing area being monitored by the caller will be at
39: * <code>subjectRegion</code>, when the receiver modifies the underlying
40: * document at a different location without wanting to interrupt the normal
41: * typing flow of the user.
42: * </p>
43: * <p>
44: * An example would be an editor that automatically increments the section
45: * number of the next section when the user typed in a new section title. In
46: * this example, the subject region is the current typing location, while
47: * the increment results in a document change further down in the text.
48: * </p>
49: *
50: * @param event the <code>DocumentEvent</code> in question
51: * @param subjectRegion the region that the caller is interested in
52: * @return <code>true</code> if <code>event</code> was triggered by the
53: * receiver and relates to <code>subjectRegion</code>
54: */
55: boolean isOriginator(DocumentEvent event, IRegion subjectRegion);
56:
57: /**
58: * Returns <code>true</code> if the receiver is showing a shell which has
59: * focus, <code>false</code> if it does not have focus or the helper has
60: * no shell.
61: *
62: * @return <code>true</code> if the support's shell has focus,
63: * <code>false</code> otherwise
64: */
65: boolean ownsFocusShell();
66: }
|