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