KickJava   Java API By Example, From Geeks To Geeks.

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


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
15 import org.eclipse.jface.text.DocumentEvent;
16 import org.eclipse.jface.text.IDocument;
17 import org.eclipse.jface.text.IRegion;
18 import org.eclipse.jface.text.ITypedRegion;
19
20
21 /**
22  * A presentation damager is a strategy used by a presentation reconciler to
23  * determine the region of the document's presentation which must be rebuilt
24  * because of a document change. A presentation damager is assumed to be
25  * specific for a particular document content type. A presentation damager is
26  * expected to return a damage region which is a valid input for a presentation
27  * repairer. I.e. having access to the damage region only the repairer must be
28  * able to derive all the information needed to successfully repair this region.
29  * <p>
30  * This interface must either be implemented by clients or clients use the
31  * rule-based default implementation
32  * {@link org.eclipse.jface.text.rules.DefaultDamagerRepairer}. Implementers
33  * should be registered with a presentation reconciler in order get involved in
34  * the reconciling process.</p>
35  *
36  * @see IPresentationReconciler
37  * @see IDocument
38  * @see DocumentEvent
39  * @see IPresentationRepairer
40  */

41 public interface IPresentationDamager {
42
43     /**
44      * Tells the presentation damager on which document it will work.
45      *
46      * @param document the damager's working document
47      */

48     void setDocument(IDocument document);
49
50     /**
51      * Returns the damage in the document's presentation caused by the given document change.
52      * The damage is restricted to the specified partition for which the presentation damager is
53      * responsible. The damage may also depend on whether the document change also caused changes
54      * of the document's partitioning.
55      *
56      * @param partition the partition inside which the damage must be determined
57      * @param event the event describing the change whose damage must be determined
58      * @param documentPartitioningChanged indicates whether the given change changed the document's partitioning
59      * @return the computed damage
60      */

61     IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event, boolean documentPartitioningChanged);
62 }
63
Popular Tags