Mercurial > projects > dwt-addons
comparison dwtx/text/edits/TextEdit.d @ 161:f8d52b926852
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:49:30 +0200 |
parents | 3678e4f1a766 |
children |
comparison
equal
deleted
inserted
replaced
160:3678e4f1a766 | 161:f8d52b926852 |
---|---|
128 null, edit1, | 128 null, edit1, |
129 TextEditMessages.getString("TextEdit.overlapping")); //$NON-NLS-1$ | 129 TextEditMessages.getString("TextEdit.overlapping")); //$NON-NLS-1$ |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 private static const TextEdit[] EMPTY_ARRAY= new TextEdit[0]; | 133 private static const TextEdit[] EMPTY_ARRAY; |
134 private static const InsertionComparator INSERTION_COMPARATOR= new InsertionComparator(); | 134 private static /+const+/ InsertionComparator INSERTION_COMPARATOR; |
135 | 135 |
136 private static const int DELETED_VALUE= -1; | 136 private static const int DELETED_VALUE= -1; |
137 | 137 |
138 private int fOffset; | 138 private int fOffset; |
139 private int fLength; | 139 private int fLength; |
149 * | 149 * |
150 * @param offset the edit's offset | 150 * @param offset the edit's offset |
151 * @param length the edit's length | 151 * @param length the edit's length |
152 */ | 152 */ |
153 protected this(int offset, int length) { | 153 protected this(int offset, int length) { |
154 if( INSERTION_COMPARATOR is null ) INSERTION_COMPARATOR= new InsertionComparator(); | |
154 Assert.isTrue(offset >= 0 && length >= 0); | 155 Assert.isTrue(offset >= 0 && length >= 0); |
155 fOffset= offset; | 156 fOffset= offset; |
156 fLength= length; | 157 fLength= length; |
157 fDelta= 0; | 158 fDelta= 0; |
158 } | 159 } |
161 * Copy constructor | 162 * Copy constructor |
162 * | 163 * |
163 * @param source the source to copy form | 164 * @param source the source to copy form |
164 */ | 165 */ |
165 protected this(TextEdit source) { | 166 protected this(TextEdit source) { |
167 if( INSERTION_COMPARATOR is null ) INSERTION_COMPARATOR= new InsertionComparator(); | |
166 fOffset= source.fOffset; | 168 fOffset= source.fOffset; |
167 fLength= source.fLength; | 169 fLength= source.fLength; |
168 fDelta= 0; | 170 fDelta= 0; |
169 } | 171 } |
170 | 172 |
538 void internalToString(StringBuffer buffer, int indent) { | 540 void internalToString(StringBuffer buffer, int indent) { |
539 for (int i= indent; i > 0; i--) { | 541 for (int i= indent; i > 0; i--) { |
540 buffer.append(" "); //$NON-NLS-1$ | 542 buffer.append(" "); //$NON-NLS-1$ |
541 } | 543 } |
542 buffer.append("{"); //$NON-NLS-1$ | 544 buffer.append("{"); //$NON-NLS-1$ |
543 String name= getClass().getName(); | 545 String name= this.classinfo.name; |
544 int index= name.lastIndexOf('.'); | 546 int index= name.lastIndexOf('.'); |
545 if (index !is -1) { | 547 if (index !is -1) { |
546 buffer.append(name.substring(index + 1)); | 548 buffer.append(name.substring(index + 1)); |
547 } else { | 549 } else { |
548 buffer.append(name); | 550 buffer.append(name); |
878 for (int i= fChildren.size() - 1; i >= 0; i--) { | 880 for (int i= fChildren.size() - 1; i >= 0; i--) { |
879 TextEdit child= cast(TextEdit)fChildren.get(i); | 881 TextEdit child= cast(TextEdit)fChildren.get(i); |
880 result= Math.max(result, child.traverseConsistencyCheck(processor, document, sourceEdits)); | 882 result= Math.max(result, child.traverseConsistencyCheck(processor, document, sourceEdits)); |
881 } | 883 } |
882 } | 884 } |
883 if (processor.considerEdit(this)) { | 885 if (processor.considerEdit_package(this)) { |
884 performConsistencyCheck(processor, document); | 886 performConsistencyCheck(processor, document); |
885 } | 887 } |
886 return result; | 888 return result; |
887 } | 889 } |
888 | 890 |
902 TextEdit child= cast(TextEdit)fChildren.get(i); | 904 TextEdit child= cast(TextEdit)fChildren.get(i); |
903 delta+= child.traverseDocumentUpdating(processor, document); | 905 delta+= child.traverseDocumentUpdating(processor, document); |
904 childDocumentUpdated(); | 906 childDocumentUpdated(); |
905 } | 907 } |
906 } | 908 } |
907 if (processor.considerEdit(this)) { | 909 if (processor.considerEdit_package(this)) { |
908 if (delta !is 0) | 910 if (delta !is 0) |
909 adjustLength(delta); | 911 adjustLength(delta); |
910 int r= performDocumentUpdating(document); | 912 int r= performDocumentUpdating(document); |
911 if (r !is 0) | 913 if (r !is 0) |
912 adjustLength(r); | 914 adjustLength(r); |