if (qualEvent != null) {
newQual = (ASTNode) qualEvent.getNewValue();
oldQual = (ASTNode) qualEvent.getOriginalValue();
}
TextEditGroup editGroup= getEditGroup(event);
if (event != null && event.getChangeKind() != RewriteEvent.UNCHANGED) {
int changeKind= event.getChangeKind();
if (changeKind == RewriteEvent.INSERTED) {
doTextInsert(offset, (ASTNode) event.getNewValue(), 0, false, editGroup);
doTextInsert(offset, " ", editGroup); //$NON-NLS-1$
if (newQual != null ) {
doTextInsert(offset, newQual, 0, false, getEditGroup(qualEvent));
doTextInsert(offset, ".", editGroup); //$NON-NLS-1$
}
doTextInsert(offset, "this", editGroup); //$NON-NLS-1$
if (newParamCount > 0) {
doTextInsert(offset, ", ", editGroup); //$NON-NLS-1$
}
} else {
ASTNode elem= (ASTNode) event.getOriginalValue();
SourceRange range= getExtendedRange(elem);
int elemOffset= range.getStartPosition();
int elemLength= range.getLength();
int elemEnd= elemOffset + elemLength;
if (changeKind == RewriteEvent.REMOVED) {
editGroup= getEditGroup(event);
int endPos;
if (oldParamCount == 0) {
endPos= getScanner().getTokenStartOffset(TerminalTokens.TokenNameRPAREN, elemEnd);
} else {
endPos= getScanner().getTokenEndOffset(TerminalTokens.TokenNameCOMMA, elemEnd);
}
doTextRemoveAndVisit(offset, endPos - offset, elem, editGroup);
return endPos;
} else if (changeKind == RewriteEvent.REPLACED) {
editGroup= getEditGroup(event);
doTextRemoveAndVisit(elemOffset, elemLength, elem, editGroup);
doTextInsert(elemOffset, (ASTNode) event.getNewValue(), 0, false, editGroup);
rewriteQualifier = true;
}
}
} else {
rewriteRequiredNode(method, MethodDeclaration.RECEIVER_TYPE_PROPERTY);
if (method.getReceiverType() != null) {
rewriteQualifier = true;
}
}
if (rewriteQualifier) {
if (qualEvent != null) {
int qualChangeKind = qualEvent.getChangeKind();
TextEditGroup qualGroup = getEditGroup(qualEvent);
if (qualChangeKind == RewriteEvent.INSERTED) {
int pos= getScanner().getTokenStartOffset(TerminalTokens.TokenNamethis, offset);
doTextInsert(pos, (ASTNode) qualEvent.getNewValue(), 0, false, qualGroup);
doTextInsert(pos, ".", qualGroup); //$NON-NLS-1$
} else if (qualChangeKind == RewriteEvent.REMOVED) {