@Override void aboutToBeAdded(TextEdit parent) { throw new MalformedTreeException(parent, this, TextEditMessages.getString("UndoEdit.can_not_be_added")); //$NON-NLS-1$ }
@Override void internalAdd(TextEdit child) throws MalformedTreeException { throw new MalformedTreeException(null, this, TextEditMessages.getString("UndoEdit.no_children")); //$NON-NLS-1$ }
@Override void aboutToBeAdded(TextEdit parent) { throw new MalformedTreeException(parent, this, TextEditMessages.getString("UndoEdit.can_not_be_added")); //$NON-NLS-1$ }
@Override void internalAdd(TextEdit child) throws MalformedTreeException { throw new MalformedTreeException(null, this, TextEditMessages.getString("UndoEdit.no_children")); //$NON-NLS-1$ }
@Override void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException { if (fTarget == null) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveSourceEdit.no_target")); //$NON-NLS-1$ if (fTarget.getSourceEdit() != this) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveSourceEdit.different_source")); //$NON-NLS-1$ /* Causes AST rewrite to fail if (getRoot() != fTarget.getRoot()) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveSourceEdit.different_tree")); //$NON-NLS-1$ */ }
@Override void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException { if (fTarget == null) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopySourceEdit.no_target")); //$NON-NLS-1$ if (fTarget.getSourceEdit() != this) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopySourceEdit.different_source")); //$NON-NLS-1$ /* causes ASTRewrite to fail if (getRoot() != fTarget.getRoot()) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopySourceEdit.different_tree")); //$NON-NLS-1$ */ }
@Override void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException { if (fTarget == null) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopySourceEdit.no_target")); //$NON-NLS-1$ if (fTarget.getSourceEdit() != this) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopySourceEdit.different_source")); //$NON-NLS-1$ /* causes ASTRewrite to fail if (getRoot() != fTarget.getRoot()) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopySourceEdit.different_tree")); //$NON-NLS-1$ */ }
@Override void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException { if (fSource == null) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopyTargetEdit.no_source")); //$NON-NLS-1$ if (fSource.getTargetEdit() != this) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopyTargetEdit.different_target")); //$NON-NLS-1$ }
@Override void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException { if (fSource == null) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveTargetEdit.no_source")); //$NON-NLS-1$ if (fSource.getTargetEdit() != this) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveTargetEdit.different_target")); //$NON-NLS-1$ }
void internalAdd(TextEdit child) throws MalformedTreeException { child.aboutToBeAdded(this); if (child.isDeleted()) throw new MalformedTreeException(this, child, TextEditMessages.getString("TextEdit.deleted_edit")); //$NON-NLS-1$ if (!covers(child)) throw new MalformedTreeException(this, child, TextEditMessages.getString("TextEdit.range_outside")); //$NON-NLS-1$ if (fChildren == null) { fChildren= new ArrayList<>(2); } int index= computeInsertionIndex(child); fChildren.add(index, child); child.internalSetParent(this); }
@Override void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException { if (fSource == null) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopyTargetEdit.no_source")); //$NON-NLS-1$ if (fSource.getTargetEdit() != this) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("CopyTargetEdit.different_target")); //$NON-NLS-1$ }
@Override void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException { if (fSource == null) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveTargetEdit.no_source")); //$NON-NLS-1$ if (fSource.getTargetEdit() != this) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveTargetEdit.different_target")); //$NON-NLS-1$ }
@Override void performConsistencyCheck(TextEditProcessor processor, IDocument document) throws MalformedTreeException { if (fTarget == null) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveSourceEdit.no_target")); //$NON-NLS-1$ if (fTarget.getSourceEdit() != this) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveSourceEdit.different_source")); //$NON-NLS-1$ /* Causes AST rewrite to fail if (getRoot() != fTarget.getRoot()) throw new MalformedTreeException(getParent(), this, TextEditMessages.getString("MoveSourceEdit.different_tree")); //$NON-NLS-1$ */ }
void internalAdd(TextEdit child) throws MalformedTreeException { child.aboutToBeAdded(this); if (child.isDeleted()) throw new MalformedTreeException(this, child, TextEditMessages.getString("TextEdit.deleted_edit")); //$NON-NLS-1$ if (!covers(child)) throw new MalformedTreeException(this, child, TextEditMessages.getString("TextEdit.range_outside")); //$NON-NLS-1$ if (fChildren == null) { fChildren= new ArrayList<>(2); } int index= computeInsertionIndex(child); fChildren.add(index, child); child.internalSetParent(this); }
void checkIntegrityDo() throws MalformedTreeException { fSourceEdits= new ArrayList<>(); fRoot.traverseConsistencyCheck(this, fDocument, fSourceEdits); if (fRoot.getExclusiveEnd() > fDocument.getLength()) throw new MalformedTreeException(null, fRoot, TextEditMessages.getString("TextEditProcessor.invalid_length")); //$NON-NLS-1$ }
void checkIntegrityUndo() { if (fRoot.getExclusiveEnd() > fDocument.getLength()) throw new MalformedTreeException(null, fRoot, TextEditMessages.getString("TextEditProcessor.invalid_length")); //$NON-NLS-1$ }
void checkIntegrityDo() throws MalformedTreeException { fSourceEdits= new ArrayList<>(); fRoot.traverseConsistencyCheck(this, fDocument, fSourceEdits); if (fRoot.getExclusiveEnd() > fDocument.getLength()) throw new MalformedTreeException(null, fRoot, TextEditMessages.getString("TextEditProcessor.invalid_length")); //$NON-NLS-1$ }
void checkIntegrityUndo() { if (fRoot.getExclusiveEnd() > fDocument.getLength()) throw new MalformedTreeException(null, fRoot, TextEditMessages.getString("TextEditProcessor.invalid_length")); //$NON-NLS-1$ }
/** * Sets the source edit. * * @param edit the source edit * * @exception MalformedTreeException is thrown if the target edit * is a direct or indirect child of the source edit */ public void setSourceEdit(MoveSourceEdit edit) { if (fSource != edit) { fSource= edit; fSource.setTargetEdit(this); TextEdit parent= getParent(); while (parent != null) { if (parent == fSource) throw new MalformedTreeException(parent, this, TextEditMessages.getString("MoveTargetEdit.wrong_parent")); //$NON-NLS-1$ parent= parent.getParent(); } } }
@Override public int compare(TextEdit edit1, TextEdit edit2) throws MalformedTreeException { int offset1= edit1.getOffset(); int length1= edit1.getLength(); int offset2= edit2.getOffset(); int length2= edit2.getLength(); if (offset1 == offset2 && length1 == 0 && length2 == 0) { return 0; } if (offset1 + length1 <= offset2) { return -1; } if (offset2 + length2 <= offset1) { return 1; } throw new MalformedTreeException( null, edit1, TextEditMessages.getString("TextEdit.overlapping")); //$NON-NLS-1$ } }