KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > text > JavaPresentationReconciler


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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
12 package org.eclipse.jdt.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 /**
21  * Presentation reconciler, adding functionality for operation without a viewer.
22  *
23  * @since 3.0
24  */

25 public class JavaPresentationReconciler extends PresentationReconciler {
26
27     /** Last used document */
28     private IDocument fLastDocument;
29
30     /**
31      * Constructs a "repair description" for the given damage and returns
32      * this description as a text presentation.
33      * <p>
34      * NOTE: Should not be used if this reconciler is installed on a viewer.
35      * </p>
36      *
37      * @param damage the damage to be repaired
38      * @param document the document whose presentation must be repaired
39      * @return the presentation repair description as text presentation
40      */

41     public TextPresentation createRepairDescription(IRegion damage, IDocument document) {
42         if (document != fLastDocument) {
43             setDocumentToDamagers(document);
44             setDocumentToRepairers(document);
45             fLastDocument= document;
46         }
47         return createPresentation(damage, document);
48     }
49 }
50
Popular Tags