0b608f99176e77edf51d99b66361d73ac3a1f574
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / text / JavaPresentationReconciler.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11
12 package net.sourceforge.phpdt.internal.ui.text;
13
14 import org.eclipse.jface.text.IDocument;
15 import org.eclipse.jface.text.IRegion;
16 import org.eclipse.jface.text.TextPresentation;
17 import org.eclipse.jface.text.presentation.PresentationReconciler;
18
19 /**
20  * Presentation reconciler, adding functionality for operation without a viewer.
21  * 
22  * @since 3.0
23  */
24 public class JavaPresentationReconciler extends PresentationReconciler {
25
26         /** Last used document */
27         private IDocument fLastDocument;
28
29         /**
30          * Constructs a "repair description" for the given damage and returns this
31          * description as a text presentation.
32          * <p>
33          * NOTE: Should not be used if this reconciler is installed on a viewer.
34          * </p>
35          * 
36          * @param damage
37          *            the damage to be repaired
38          * @param document
39          *            the document whose presentation must be repaired
40          * @return the presentation repair description as text presentation
41          */
42         public TextPresentation createRepairDescription(IRegion damage,
43                         IDocument document) {
44                 if (document != fLastDocument) {
45                         setDocumentToDamagers(document);
46                         setDocumentToRepairers(document);
47                 }
48                 return createPresentation(damage, document);
49         }
50 }