A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / corext / textmanipulation / NopTextEdit.java
1 /*
2  * (c) Copyright IBM Corp. 2000, 2001.
3  * All Rights Reserved.
4  */
5 package net.sourceforge.phpdt.internal.corext.textmanipulation;
6
7 import org.eclipse.core.runtime.CoreException;
8
9 /**
10  * A text edit that does nothing. A <code>NopTextEdit</code> can be used to
11  * track positions when executing <code>TextEdits</code> associated with a
12  * <code>
13  * TextBufferEditor</code>.
14  */
15 public class NopTextEdit extends TextEdit {
16
17         private TextRange fTextRange;
18
19         /**
20          * Creates a new <code>NopTextEdit</code> for the given offset and length.
21          * 
22          * @param offset
23          *            the starting offset this text edit is "working on"
24          * @param length
25          *            the length this text edit is "working on"
26          */
27         public NopTextEdit(int offset, int length) {
28                 this(new TextRange(offset, length));
29         }
30
31         /**
32          * Creates a new <code>NopTextEdit</code> for the given range.
33          * 
34          * @param range
35          *            the <code>TextRange</code> this text edit is "working on"
36          */
37         public NopTextEdit(TextRange range) {
38                 fTextRange = range;
39         }
40
41         /*
42          * non Java-doc
43          * 
44          * @see TextEdit#getTextRange
45          */
46         public TextRange getTextRange() {
47                 return fTextRange;
48         }
49
50         /*
51          * non Java-doc
52          * 
53          * @see TextEdit#perform
54          */
55         public TextEdit perform(TextBuffer buffer) throws CoreException {
56                 return new NopTextEdit(fTextRange);
57         }
58
59         /*
60          * non Java-doc
61          * 
62          * @see TextEdit#perform
63          */
64         public TextEdit copy() {
65                 return new NopTextEdit(fTextRange.copy());
66         }
67 }