129
|
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 * Port to the D programming language:
|
|
11 * Frank Benoit <benoit@tionex.de>
|
|
12 *******************************************************************************/
|
|
13 module dwtx.jface.text.presentation.IPresentationReconciler;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17
|
|
18 import dwtx.jface.text.ITextViewer;
|
|
19
|
|
20
|
|
21 /**
|
|
22 * An <code>IPresentationReconciler</code> defines and maintains the
|
|
23 * representation of a text viewer's document in the presence of changes applied
|
|
24 * to the document. An <code>IPresentationReconciler</code> is a
|
|
25 * <code>ITextViewer</code> add-on.
|
|
26 * <p>
|
|
27 * The presentation reconciler keeps track of changes applied to the text
|
|
28 * viewer. It sends each change to presentation damagers which are registered
|
|
29 * for the content types of the regions in which the change occurred. The
|
|
30 * presentation reconciler passes the computed damage to presentation repairer
|
|
31 * which construct text presentations. When applied to the presentation
|
|
32 * reconciler's text viewer, those text presentations bring the document's
|
|
33 * presentation in sync with the document's content and thus repair the damage.
|
|
34 * A presentation damager is expected to return damage which is a valid input
|
|
35 * for a presentation repairer registered for the same content type as the
|
|
36 * damager.
|
|
37 * </p>
|
|
38 * <p>
|
|
39 * A presentation reconciler should always be configured with a pair of
|
|
40 * damager/repairer strategies. I.e. for each damager there should be a
|
|
41 * corresponding repairer.
|
|
42 * </p>
|
|
43 * <p>
|
|
44 * The interface may be implemented by clients. Clients may use
|
|
45 * <code>PresentationReconciler</code> as the standard implementation of this
|
|
46 * interface.
|
|
47 * </p>
|
|
48 * <p>
|
|
49 * In order to provided backward compatibility for clients of
|
|
50 * <code>IPresentationReconciler</code>, extension interfaces are used to
|
|
51 * provide a means of evolution. The following extension interface exists:
|
|
52 * <ul>
|
|
53 * <li>
|
|
54 * {@link dwtx.jface.text.presentation.IPresentationReconcilerExtension}
|
|
55 * since version 3.0 adding support for documents with multiple partitionings.
|
|
56 * </li>
|
|
57 * </ul>
|
|
58 * </p>
|
|
59 *
|
|
60 * @see dwtx.jface.text.presentation.IPresentationReconcilerExtension
|
|
61 * @see dwtx.jface.text.ITextViewer
|
|
62 * @see dwtx.jface.text.presentation.IPresentationDamager
|
|
63 * @see dwtx.jface.text.presentation.IPresentationRepairer
|
|
64 * @see dwtx.jface.text.TextPresentation
|
|
65 */
|
|
66 public interface IPresentationReconciler {
|
|
67
|
|
68 /**
|
|
69 * Installs this presentation reconciler on the given text viewer. After
|
|
70 * this method has been finished, the reconciler is operational. I.e., it
|
|
71 * works without requesting further client actions until
|
|
72 * <code>uninstall</code> is called.
|
|
73 * <p>
|
|
74 * The <code>install</code> and <code>uninstall</code> methods must be
|
|
75 * called in sequence; i.e. repeatedly calling <code>install</code>
|
|
76 * without calling <code>uninstall</code> may throw an exception.
|
|
77 * </p>
|
|
78 *
|
|
79 * @param viewer the viewer on which this presentation reconciler is
|
|
80 * installed
|
|
81 */
|
|
82 void install(ITextViewer viewer);
|
|
83
|
|
84 /**
|
|
85 * Removes the reconciler from the text viewer it has previously been
|
|
86 * installed on.
|
|
87 */
|
|
88 void uninstall();
|
|
89
|
|
90 /**
|
|
91 * Returns the presentation damager registered with this presentation reconciler
|
|
92 * for the specified content type.
|
|
93 *
|
|
94 * @param contentType the content type for which to determine the damager
|
|
95 * @return the presentation damager registered for the given content type, or
|
|
96 * <code>null</code> if there is no damager
|
|
97 */
|
|
98 IPresentationDamager getDamager(String contentType);
|
|
99
|
|
100 /**
|
|
101 * Returns the presentation repairer registered with this presentation reconciler
|
|
102 * for the specified content type.
|
|
103 *
|
|
104 * @param contentType the content type for which to determine the repairer
|
|
105 * @return the presentation repairer registered for the given content type, or
|
|
106 * <code>null</code> if there is no repairer
|
|
107 */
|
|
108 IPresentationRepairer getRepairer(String contentType);
|
|
109 }
|