Mercurial > projects > dwt2
comparison org.eclipse.text/src/org/eclipse/text/edits/CopyingRangeMarker.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children | 5feec68b4556 |
comparison
equal
deleted
inserted
replaced
11:43904fec5dca | 12:bc29606a740c |
---|---|
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 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module org.eclipse.text.edits.CopyingRangeMarker; | |
14 | |
15 import org.eclipse.text.edits.MultiTextEdit; // packageimport | |
16 import org.eclipse.text.edits.CopySourceEdit; // packageimport | |
17 import org.eclipse.text.edits.MoveSourceEdit; // packageimport | |
18 import org.eclipse.text.edits.ReplaceEdit; // packageimport | |
19 import org.eclipse.text.edits.EditDocument; // packageimport | |
20 import org.eclipse.text.edits.UndoCollector; // packageimport | |
21 import org.eclipse.text.edits.DeleteEdit; // packageimport | |
22 import org.eclipse.text.edits.MoveTargetEdit; // packageimport | |
23 import org.eclipse.text.edits.CopyTargetEdit; // packageimport | |
24 import org.eclipse.text.edits.TextEditCopier; // packageimport | |
25 import org.eclipse.text.edits.ISourceModifier; // packageimport | |
26 import org.eclipse.text.edits.TextEditMessages; // packageimport | |
27 import org.eclipse.text.edits.TextEditProcessor; // packageimport | |
28 import org.eclipse.text.edits.MalformedTreeException; // packageimport | |
29 import org.eclipse.text.edits.TreeIterationInfo; // packageimport | |
30 import org.eclipse.text.edits.TextEditVisitor; // packageimport | |
31 import org.eclipse.text.edits.TextEditGroup; // packageimport | |
32 import org.eclipse.text.edits.TextEdit; // packageimport | |
33 import org.eclipse.text.edits.RangeMarker; // packageimport | |
34 import org.eclipse.text.edits.UndoEdit; // packageimport | |
35 import org.eclipse.text.edits.InsertEdit; // packageimport | |
36 | |
37 | |
38 import java.lang.all; | |
39 import java.util.Set; | |
40 | |
41 import org.eclipse.jface.text.BadLocationException; | |
42 import org.eclipse.jface.text.IDocument; | |
43 | |
44 /** | |
45 * A <code>CopyingRangeMarker</code> can be used to track positions when executing | |
46 * text edits. Additionally a copying range marker stores a local copy of the | |
47 * text it captures when it gets executed. | |
48 * | |
49 * @since 3.0 | |
50 */ | |
51 public final class CopyingRangeMarker : TextEdit { | |
52 | |
53 private String fText; | |
54 | |
55 /** | |
56 * Creates a new <tt>CopyRangeMarker</tt> for the given | |
57 * offset and length. | |
58 * | |
59 * @param offset the marker's offset | |
60 * @param length the marker's length | |
61 */ | |
62 public this(int offset, int length) { | |
63 super(offset, length); | |
64 } | |
65 | |
66 /* | |
67 * Copy constructor | |
68 */ | |
69 private this(CopyingRangeMarker other) { | |
70 super(other); | |
71 fText= other.fText; | |
72 } | |
73 | |
74 /* | |
75 * @see TextEdit#doCopy | |
76 */ | |
77 protected TextEdit doCopy() { | |
78 return new CopyingRangeMarker(this); | |
79 } | |
80 | |
81 /* | |
82 * @see TextEdit#accept0 | |
83 */ | |
84 protected void accept0(TextEditVisitor visitor) { | |
85 bool visitChildren= visitor.visit(this); | |
86 if (visitChildren) { | |
87 acceptChildren(visitor); | |
88 } | |
89 } | |
90 | |
91 /* | |
92 * @see TextEdit#performDocumentUpdating | |
93 */ | |
94 int performDocumentUpdating(IDocument document) { | |
95 fText= document.get(getOffset(), getLength()); | |
96 fDelta= 0; | |
97 return fDelta; | |
98 } | |
99 | |
100 /* | |
101 * @see TextEdit#deleteChildren | |
102 */ | |
103 bool deleteChildren() { | |
104 return false; | |
105 } | |
106 } |