X-Git-Url: http://git.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 ae29be5..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 @@ -8,9 +8,8 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import org.eclipse.core.internal.utils.Assert; import org.eclipse.core.runtime.CoreException; - +import org.eclipse.jface.util.Assert; public class MultiTextEdit { @@ -20,40 +19,42 @@ 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()); } } - + protected List getChildren() { return fChildren; } - + /** * 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); fChildren.add(edit); } - + /** * 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); fChildren.add(edit); } - + /** * Returns the children managed by this text edit collection. * @@ -64,66 +65,69 @@ 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. - * - * @return a copy of this object. - */ + * 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 { return new MultiTextEdit(fChildren); } - + /** * 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 * @@ -131,6 +135,5 @@ public class MultiTextEdit { */ public Object getModifiedElement() { return null; - } + } } -