Skip to main content
summaryrefslogtreecommitdiffstats
blob: 2b8fc3350aa3097e2de78617cde151ddcc3e0a09 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package org.eclipse.cdt.internal.corext.textmanipulation;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */
 
import org.eclipse.core.runtime.CoreException;

/**
 * A text edit that does nothing. A <code>NopTextEdit</code> can be used to track
 * positions when executing <code>TextEdits</code> associated with a <code>
 * TextBufferEditor</code>.
 */
public class NopTextEdit extends TextEdit {
	
	private TextRange fTextRange;
	
	/**
	 * Creates a new <code>NopTextEdit</code> for the given
	 * offset and length.
	 * 
	 * @param offset the starting offset this text edit is "working on"
	 * @param length the length this text edit is "working on"
	 */
	public NopTextEdit(int offset, int length) {
		this(new TextRange(offset, length));
	}
	
	/**
	 * Creates a new <code>NopTextEdit</code> for the given
	 * range.
	 * 
	 * @param range the <code>TextRange</code> this text edit is "working on"
	 */
	public NopTextEdit(TextRange range) {
		fTextRange= range;
	}

	/* non Java-doc
	 * @see TextEdit#getTextRange
	 */	
	public TextRange getTextRange() {
		return fTextRange;
	}

	/* non Java-doc
	 * @see TextEdit#perform
	 */	
	public TextEdit perform(TextBuffer buffer) throws CoreException {
		return new NopTextEdit(fTextRange);
	}
	
	/* non Java-doc
	 * @see TextEdit#perform
	 */	
	public TextEdit copy() {
		return new NopTextEdit(fTextRange.copy());
	}	
}

Back to the top