comparison dwtx/text/edits/TextEditCopier.d @ 134:51e6e63f930e

Regex fix for casts
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 01:46:20 +0200
parents c4fb132a086c
children f70d9508c95c
comparison
equal deleted inserted replaced
133:7d818bd32d63 134:51e6e63f930e
81 */ 81 */
82 public TextEdit perform() { 82 public TextEdit perform() {
83 TextEdit result= doCopy(fEdit); 83 TextEdit result= doCopy(fEdit);
84 if (result !is null) { 84 if (result !is null) {
85 for (Iterator iter= fCopies.keySet().iterator(); iter.hasNext();) { 85 for (Iterator iter= fCopies.keySet().iterator(); iter.hasNext();) {
86 TextEdit edit= (TextEdit)iter.next(); 86 TextEdit edit= cast(TextEdit)iter.next();
87 edit.postProcessCopy(this); 87 edit.postProcessCopy(this);
88 } 88 }
89 } 89 }
90 return result; 90 return result;
91 } 91 }
98 * @return the copy of the original edit or <code>null</code> 98 * @return the copy of the original edit or <code>null</code>
99 * if the original isn't managed by this copier 99 * if the original isn't managed by this copier
100 */ 100 */
101 public TextEdit getCopy(TextEdit original) { 101 public TextEdit getCopy(TextEdit original) {
102 Assert.isNotNull(original); 102 Assert.isNotNull(original);
103 return (TextEdit)fCopies.get(original); 103 return cast(TextEdit)fCopies.get(original);
104 } 104 }
105 105
106 //---- helper methods -------------------------------------------- 106 //---- helper methods --------------------------------------------
107 107
108 private TextEdit doCopy(TextEdit edit) { 108 private TextEdit doCopy(TextEdit edit) {
109 TextEdit result= edit.doCopy(); 109 TextEdit result= edit.doCopy();
110 List children= edit.internalGetChildren(); 110 List children= edit.internalGetChildren();
111 if (children !is null) { 111 if (children !is null) {
112 List newChildren= new ArrayList(children.size()); 112 List newChildren= new ArrayList(children.size());
113 for (Iterator iter= children.iterator(); iter.hasNext();) { 113 for (Iterator iter= children.iterator(); iter.hasNext();) {
114 TextEdit childCopy= doCopy((TextEdit)iter.next()); 114 TextEdit childCopy= doCopy(cast(TextEdit)iter.next());
115 childCopy.internalSetParent(result); 115 childCopy.internalSetParent(result);
116 newChildren.add(childCopy); 116 newChildren.add(childCopy);
117 } 117 }
118 result.internalSetChildren(newChildren); 118 result.internalSetChildren(newChildren);
119 } 119 }