Source:
protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.CANCEL_ID) { super.buttonPressed(0); parent.setFocus(); return; } IComment comment = ReviewsFactory.eINSTANCE.createComment(); comment.setDescription(fCommentInputTextField.getText().trim()); if (buttonId == buttonEdit_ID) { comment.setId(currentUuid); deleteButtons(); createSaveDiscard(); return; } else if (buttonId == buttonDiscard_ID) { comment.setId(currentUuid); bDiscard = true; } else if (buttonId == buttonReply_ID) { comment.setId(currentUuid); bSave = true; bReply = true; deleteButtons(); if (reviewitem.getReview().getRepository().getAccount().toString().compareTo(currentAuthor) == 0) { createSaveDiscard(); } else { createSave(); } fCommentInputTextField.setText(""); } else if (buttonId == buttonReplyDone_ID) { bSave = true; bDone = true; comment.setDescription(Messages.CommentInputDialog_Done); comment.setParentId(currentUuid); comment.setId(""); } else if (buttonId == buttonSave_ID) { comment.setId(currentUuid); bSave = true; if (bReply) { bDone = true; comment.setParentId(currentUuid); comment.setId(""); bReply = false; } } comment.setDraft(true); comment.setAuthor(reviewitem.getReview().getRepository().getAccount()); Date created = new Date(); comment.setCreationDate(created); LineRange selectedRange = range; ILineLocation location = ReviewsFactory.eINSTANCE.createLineLocation(); ILineRange aRange = ReviewsFactory.eINSTANCE.createLineRange(); aRange.setStart(selectedRange.getStartLine()); aRange.setEnd(selectedRange.getStartLine() + selectedRange.getNumberOfLines()); location.getRanges().add(aRange); if (location != null) { comment.getLocations().add(location); } if (buttonId != buttonReply_ID) { performOperation(comment); super.buttonPressed(0); } }

Target:
protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.CANCEL_ID) { super.buttonPressed(0); parent.setFocus(); return; } IComment comment = ReviewsFactory.eINSTANCE.createComment(); comment.setDescription(fCommentInputTextField.getText().trim()); switch (buttonId) { case buttonEdit_ID: comment.setId(currentUuid); deleteButtons(); createSaveDiscard(); return; case buttonDiscard_ID: comment.setId(currentUuid); bDiscard = true; break; case buttonReply_ID: comment.setId(currentUuid); bSave = true; bReply = true; deleteButtons(); if (isMine()) { createSaveDiscard(); } else { createSave(); } fCommentInputTextField.setText(""); break; case buttonReplyDone_ID: bSave = true; bDone = true; comment.setDescription(Messages.CommentInputDialog_Done); comment.setParentId(currentUuid); comment.setId(""); break; case buttonSave_ID: comment.setId(currentUuid); bSave = true; if (bReply) { bDone = true; comment.setParentId(currentUuid); comment.setId(""); bReply = false; } } comment.setDraft(true); comment.setAuthor(reviewitem.getReview().getRepository().getAccount()); comment.setCreationDate(new Date()); LineRange selectedRange = range; ILineLocation location = ReviewsFactory.eINSTANCE.createLineLocation(); ILineRange aRange = ReviewsFactory.eINSTANCE.createLineRange(); aRange.setStart(selectedRange.getStartLine()); aRange.setEnd(selectedRange.getStartLine() + selectedRange.getNumberOfLines()); location.getRanges().add(aRange); if (location != null) { comment.getLocations().add(location); } if (buttonId != buttonReply_ID) { performOperation(comment); super.buttonPressed(0); } }