KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > editor > text > MultilineDamagerRepairer


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.ant.internal.ui.editor.text;
12
13
14 import org.eclipse.jface.text.DocumentEvent;
15 import org.eclipse.jface.text.IRegion;
16 import org.eclipse.jface.text.ITypedRegion;
17 import org.eclipse.jface.text.TextAttribute;
18 import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
19 import org.eclipse.jface.text.rules.ITokenScanner;
20
21 /**
22  * Considers multilines as damage regions even if the document partitioning has not changed.
23  *
24  * @see org.eclipse.jface.text.rules.DefaultDamagerRepairer
25  */

26 public class MultilineDamagerRepairer extends DefaultDamagerRepairer {
27
28     public MultilineDamagerRepairer(ITokenScanner scanner, TextAttribute defaultTextAttribute) {
29         super(scanner, defaultTextAttribute);
30     }
31     
32     public MultilineDamagerRepairer(ITokenScanner scanner) {
33         super(scanner);
34     }
35     
36     /* (non-Javadoc)
37      * @see org.eclipse.jface.text.presentation.IPresentationDamager#getDamageRegion(org.eclipse.jface.text.ITypedRegion, org.eclipse.jface.text.DocumentEvent, boolean)
38      */

39     public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
40         return partition;
41     }
42
43     /**
44      * Configures the scanner's default return token. This is the text attribute
45      * which is returned when none is returned by the current token.
46      */

47     public void setDefaultTextAttribute(TextAttribute defaultTextAttribute) {
48         fDefaultTextAttribute= defaultTextAttribute;
49     }
50 }
51
Popular Tags