X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/MultiTextEdit.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/MultiTextEdit.java index a416650..5973efd 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/MultiTextEdit.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/corext/textmanipulation/MultiTextEdit.java @@ -11,7 +11,6 @@ import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.util.Assert; - public class MultiTextEdit { private List fChildren; @@ -20,13 +19,13 @@ public class MultiTextEdit { * Creates a new composite text edit. */ public MultiTextEdit() { - fChildren= new ArrayList(3); + fChildren = new ArrayList(3); } protected MultiTextEdit(List children) throws CoreException { - fChildren= new ArrayList(children.size()); - for (Iterator iter= children.iterator(); iter.hasNext();) { - fChildren.add(((TextEdit)iter.next()).copy()); + fChildren = new ArrayList(children.size()); + for (Iterator iter = children.iterator(); iter.hasNext();) { + fChildren.add(((TextEdit) iter.next()).copy()); } } @@ -37,7 +36,8 @@ public class MultiTextEdit { /** * Adds all TextEdits managed by the given multt text edit. * - * @param edit the multi text edit to be added. + * @param edit + * the multi text edit to be added. */ public void add(MultiTextEdit edit) { Assert.isNotNull(edit); @@ -47,7 +47,8 @@ public class MultiTextEdit { /** * Adds a text edit. * - * @param edit the text edit to be added + * @param edit + * the text edit to be added */ public void add(TextEdit edit) { Assert.isNotNull(edit); @@ -64,31 +65,33 @@ public class MultiTextEdit { } /** - * Connects this text edit to the given TextBufferEditor. + * Connects this text edit to the given TextBufferEditor. * Note that this method should only be called by a * TextBufferEditor. - *

- * This default implementation does nothing. Subclasses may override - * if needed. - * - * @param editor the text buffer editor this text edit has been added to + *

+ * This default implementation does nothing. Subclasses may override if + * needed. + * + * @param editor + * the text buffer editor this text edit has been added to */ public void connect(TextBufferEditor editor) throws CoreException { - for (Iterator iter= fChildren.iterator(); iter.hasNext();) { - Object element= iter.next(); + for (Iterator iter = fChildren.iterator(); iter.hasNext();) { + Object element = iter.next(); if (element instanceof TextEdit) - editor.add((TextEdit)element); + editor.add((TextEdit) element); else - editor.add((MultiTextEdit)element); + editor.add((MultiTextEdit) element); } } /** - * Creates and returns a copy of this text edit collection. The copy method should - * be implemented in a way so that the copy can be added to a different - * TextBuffer without causing any harm to the object from which the copy - * has been created. - * + * Creates and returns a copy of this text edit collection. The copy method + * should be implemented in a way so that the copy can be added to a + * different + * TextBuffer without causing any harm to the + * object from which the copy has been created. + * * @return a copy of this object. */ public MultiTextEdit copy() throws CoreException { @@ -97,33 +100,34 @@ public class MultiTextEdit { /** * Returns the TextRange that this text edit is going to - * manipulate. If this method is called before the MultiTextEdit - * has been added to a TextBufferEditor it may return - * null to indicate this situation. + * manipulate. If this method is called before the + * MultiTextEdit has been added to a + * TextBufferEditor it may return + * null to + * indicate this situation. * * @return the TextRanges this TextEdit is going * to manipulate */ public TextRange getTextRange() { - int size= fChildren.size(); + int size = fChildren.size(); if (size == 0) - return new TextRange(0,0); - TextRange range= ((TextEdit)fChildren.get(0)).getTextRange(); - int start= range.getOffset(); - int end= range.getInclusiveEnd(); - for (int i= 1; i < size; i++) { - range= ((TextEdit)fChildren.get(i)).getTextRange(); - start= Math.min(start, range.getOffset()); - end= Math.max(end, range.getInclusiveEnd()); + return new TextRange(0, 0); + TextRange range = ((TextEdit) fChildren.get(0)).getTextRange(); + int start = range.getOffset(); + int end = range.getInclusiveEnd(); + for (int i = 1; i < size; i++) { + range = ((TextEdit) fChildren.get(i)).getTextRange(); + start = Math.min(start, range.getOffset()); + end = Math.max(end, range.getInclusiveEnd()); } return new TextRange(start, end - start + 1); } /** - * Returns the element modified by this text edit. The method - * may return null if the modification isn't related to a - * element or if the content of the modified text buffer doesn't - * follow any syntax. + * Returns the element modified by this text edit. The method may return + * null if the modification isn't related to a element or if + * the content of the modified text buffer doesn't follow any syntax. *

* This default implementation returns null * @@ -133,4 +137,3 @@ public class MultiTextEdit { return null; } } -