KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > text > edits > RangeMarker


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 package org.eclipse.text.edits;
12
13 import org.eclipse.jface.text.BadLocationException;
14 import org.eclipse.jface.text.IDocument;
15
16 /**
17  * A range marker can be used to track positions when executing
18  * text edits.
19  *
20  * @since 3.0
21  */

22 public final class RangeMarker extends TextEdit {
23
24     /**
25      * Creates a new range marker for the given offset and length.
26      *
27      * @param offset the marker's offset
28      * @param length the marker's length
29      */

30     public RangeMarker(int offset, int length) {
31         super(offset, length);
32     }
33
34     /*
35      * Copy constructor
36      */

37     private RangeMarker(RangeMarker other) {
38         super(other);
39     }
40
41     /*
42      * @see TextEdit#copy
43      */

44     protected TextEdit doCopy() {
45         return new RangeMarker(this);
46     }
47
48     /*
49      * @see TextEdit#accept0
50      */

51     protected void accept0(TextEditVisitor visitor) {
52         boolean visitChildren= visitor.visit(this);
53         if (visitChildren) {
54             acceptChildren(visitor);
55         }
56     }
57
58     /*
59      * @see TextEdit#performDocumentUpdating
60      */

61     int performDocumentUpdating(IDocument document) throws BadLocationException {
62         fDelta= 0;
63         return fDelta;
64     }
65
66     /*
67      * @see TextEdit#deleteChildren
68      */

69     boolean deleteChildren() {
70         return false;
71     }
72 }
73
Popular Tags