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.IPresentationDamager;
|
|
14
|
|
15 import dwt.dwthelper.utils;
|
|
16
|
|
17
|
|
18
|
|
19 import dwtx.jface.text.DocumentEvent;
|
|
20 import dwtx.jface.text.IDocument;
|
|
21 import dwtx.jface.text.IRegion;
|
|
22 import dwtx.jface.text.ITypedRegion;
|
|
23
|
|
24
|
|
25 /**
|
|
26 * A presentation damager is a strategy used by a presentation reconciler to
|
|
27 * determine the region of the document's presentation which must be rebuilt
|
|
28 * because of a document change. A presentation damager is assumed to be
|
|
29 * specific for a particular document content type. A presentation damager is
|
|
30 * expected to return a damage region which is a valid input for a presentation
|
|
31 * repairer. I.e. having access to the damage region only the repairer must be
|
|
32 * able to derive all the information needed to successfully repair this region.
|
|
33 * <p>
|
|
34 * This interface must either be implemented by clients or clients use the
|
|
35 * rule-based default implementation
|
|
36 * {@link dwtx.jface.text.rules.DefaultDamagerRepairer}. Implementers
|
|
37 * should be registered with a presentation reconciler in order get involved in
|
|
38 * the reconciling process.</p>
|
|
39 *
|
|
40 * @see IPresentationReconciler
|
|
41 * @see IDocument
|
|
42 * @see DocumentEvent
|
|
43 * @see IPresentationRepairer
|
|
44 */
|
|
45 public interface IPresentationDamager {
|
|
46
|
|
47 /**
|
|
48 * Tells the presentation damager on which document it will work.
|
|
49 *
|
|
50 * @param document the damager's working document
|
|
51 */
|
|
52 void setDocument(IDocument document);
|
|
53
|
|
54 /**
|
|
55 * Returns the damage in the document's presentation caused by the given document change.
|
|
56 * The damage is restricted to the specified partition for which the presentation damager is
|
|
57 * responsible. The damage may also depend on whether the document change also caused changes
|
|
58 * of the document's partitioning.
|
|
59 *
|
|
60 * @param partition the partition inside which the damage must be determined
|
|
61 * @param event the event describing the change whose damage must be determined
|
|
62 * @param documentPartitioningChanged indicates whether the given change changed the document's partitioning
|
|
63 * @return the computed damage
|
|
64 */
|
|
65 IRegion getDamageRegion(ITypedRegion partition, DocumentEvent event, bool documentPartitioningChanged);
|
|
66 }
|