KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > text > presentation > IPresentationReconciler


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.presentation;
12
13
14 import org.eclipse.jface.text.ITextViewer;
15
16
17 /**
18  * An <code>IPresentationReconciler</code> defines and maintains the
19  * representation of a text viewer's document in the presence of changes applied
20  * to the document. An <code>IPresentationReconciler</code> is a
21  * <code>ITextViewer</code> add-on.
22  * <p>
23  * The presentation reconciler keeps track of changes applied to the text
24  * viewer. It sends each change to presentation damagers which are registered
25  * for the content types of the regions in which the change occurred. The
26  * presentation reconciler passes the computed damage to presentation repairer
27  * which construct text presentations. When applied to the presentation
28  * reconciler's text viewer, those text presentations bring the document's
29  * presentation in sync with the document's content and thus repair the damage.
30  * A presentation damager is expected to return damage which is a valid input
31  * for a presentation repairer registered for the same content type as the
32  * damager.
33  * </p>
34  * <p>
35  * A presentation reconciler should always be configured with a pair of
36  * damager/repairer strategies. I.e. for each damager there should be a
37  * corresponding repairer.
38  * </p>
39  * <p>
40  * The interface may be implemented by clients. Clients may use
41  * <code>PresentationReconciler</code> as the standard implementation of this
42  * interface.
43  * </p>
44  * <p>
45  * In order to provided backward compatibility for clients of
46  * <code>IPresentationReconciler</code>, extension interfaces are used to
47  * provide a means of evolution. The following extension interface exists:
48  * <ul>
49  * <li>
50  * {@link org.eclipse.jface.text.presentation.IPresentationReconcilerExtension}
51  * since version 3.0 adding support for documents with multiple partitionings.
52  * </li>
53  * </ul>
54  * </p>
55  *
56  * @see org.eclipse.jface.text.presentation.IPresentationReconcilerExtension
57  * @see org.eclipse.jface.text.ITextViewer
58  * @see org.eclipse.jface.text.presentation.IPresentationDamager
59  * @see org.eclipse.jface.text.presentation.IPresentationRepairer
60  * @see org.eclipse.jface.text.TextPresentation
61  */

62 public interface IPresentationReconciler {
63
64     /**
65      * Installs this presentation reconciler on the given text viewer. After
66      * this method has been finished, the reconciler is operational. I.e., it
67      * works without requesting further client actions until
68      * <code>uninstall</code> is called.
69      * <p>
70      * The <code>install</code> and <code>uninstall</code> methods must be
71      * called in sequence; i.e. repeatedly calling <code>install</code>
72      * without calling <code>uninstall</code> may throw an exception.
73      * </p>
74      *
75      * @param viewer the viewer on which this presentation reconciler is
76      * installed
77      */

78     void install(ITextViewer viewer);
79
80     /**
81      * Removes the reconciler from the text viewer it has previously been
82      * installed on.
83      */

84     void uninstall();
85
86     /**
87      * Returns the presentation damager registered with this presentation reconciler
88      * for the specified content type.
89      *
90      * @param contentType the content type for which to determine the damager
91      * @return the presentation damager registered for the given content type, or
92      * <code>null</code> if there is no damager
93      */

94     IPresentationDamager getDamager(String JavaDoc contentType);
95
96     /**
97      * Returns the presentation repairer registered with this presentation reconciler
98      * for the specified content type.
99      *
100      * @param contentType the content type for which to determine the repairer
101      * @return the presentation repairer registered for the given content type, or
102      * <code>null</code> if there is no repairer
103      */

104     IPresentationRepairer getRepairer(String JavaDoc contentType);
105 }
106
Popular Tags