Mercurial > projects > dwt-addons
annotate dwtx/text/edits/DeleteEdit.d @ 136:6dcb0baaa031
Regex removal of throws decls, some instanceof
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:20:40 +0200 |
parents | c4fb132a086c |
children |
rev | line source |
---|---|
129 | 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 dwtx.text.edits.DeleteEdit; | |
14 | |
131 | 15 import dwtx.text.edits.MultiTextEdit; // packageimport |
16 import dwtx.text.edits.CopySourceEdit; // packageimport | |
17 import dwtx.text.edits.MoveSourceEdit; // packageimport | |
18 import dwtx.text.edits.CopyingRangeMarker; // packageimport | |
19 import dwtx.text.edits.ReplaceEdit; // packageimport | |
20 import dwtx.text.edits.EditDocument; // packageimport | |
21 import dwtx.text.edits.UndoCollector; // packageimport | |
22 import dwtx.text.edits.MoveTargetEdit; // packageimport | |
23 import dwtx.text.edits.CopyTargetEdit; // packageimport | |
24 import dwtx.text.edits.TextEditCopier; // packageimport | |
25 import dwtx.text.edits.ISourceModifier; // packageimport | |
26 import dwtx.text.edits.TextEditMessages; // packageimport | |
27 import dwtx.text.edits.TextEditProcessor; // packageimport | |
28 import dwtx.text.edits.MalformedTreeException; // packageimport | |
29 import dwtx.text.edits.TreeIterationInfo; // packageimport | |
30 import dwtx.text.edits.TextEditVisitor; // packageimport | |
31 import dwtx.text.edits.TextEditGroup; // packageimport | |
32 import dwtx.text.edits.TextEdit; // packageimport | |
33 import dwtx.text.edits.RangeMarker; // packageimport | |
34 import dwtx.text.edits.UndoEdit; // packageimport | |
35 import dwtx.text.edits.InsertEdit; // packageimport | |
36 | |
37 | |
129 | 38 import dwt.dwthelper.utils; |
39 | |
40 import dwtx.jface.text.BadLocationException; | |
41 import dwtx.jface.text.IDocument; | |
42 | |
43 /** | |
44 * Text edit to delete a range in a document. | |
45 * <p> | |
46 * A delete edit is equivalent to <code>ReplaceEdit( | |
47 * offset, length, "")</code>. | |
48 * | |
49 * @since 3.0 | |
50 */ | |
51 public final class DeleteEdit : TextEdit { | |
52 | |
53 /** | |
54 * Constructs a new delete edit. | |
55 * | |
56 * @param offset the offset of the range to replace | |
57 * @param length the length of the range to replace | |
58 */ | |
130 | 59 public this(int offset, int length) { |
129 | 60 super(offset, length); |
61 } | |
62 | |
63 /* | |
64 * Copy constructor | |
65 */ | |
130 | 66 private this(DeleteEdit other) { |
129 | 67 super(other); |
68 } | |
69 | |
70 /* | |
71 * @see TextEdit#doCopy | |
72 */ | |
73 protected TextEdit doCopy() { | |
74 return new DeleteEdit(this); | |
75 } | |
76 | |
77 /* | |
78 * @see TextEdit#accept0 | |
79 */ | |
80 protected void accept0(TextEditVisitor visitor) { | |
81 bool visitChildren= visitor.visit(this); | |
82 if (visitChildren) { | |
83 acceptChildren(visitor); | |
84 } | |
85 } | |
86 | |
87 /* | |
88 * @see TextEdit#performDocumentUpdating | |
89 */ | |
136
6dcb0baaa031
Regex removal of throws decls, some instanceof
Frank Benoit <benoit@tionex.de>
parents:
131
diff
changeset
|
90 int performDocumentUpdating(IDocument document) { |
129 | 91 document.replace(getOffset(), getLength(), ""); //$NON-NLS-1$ |
92 fDelta= -getLength(); | |
93 return fDelta; | |
94 } | |
95 | |
96 /* | |
97 * @see TextEdit#deleteChildren | |
98 */ | |
99 bool deleteChildren() { | |
100 return true; | |
101 } | |
102 } |