/** @return true if commit info is ok */ public boolean checkCommitInfo() { updateStateFromUI(); if (commitMessage.trim().length() == 0) { MessageDialog.openWarning( getShell(), UIText.CommitDialog_ErrorNoMessage, UIText.CommitDialog_ErrorMustEnterCommitMessage); return false; } boolean authorValid = false; if (author.length() > 0) authorValid = RawParseUtils.parsePersonIdent(author) != null; if (!authorValid) { MessageDialog.openWarning( getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidAuthorSpecified); return false; } boolean committerValid = false; if (committer.length() > 0) committerValid = RawParseUtils.parsePersonIdent(committer) != null; if (!committerValid) { MessageDialog.openWarning( getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidCommitterSpecified); return false; } authorHandler.updateProposals(); committerHandler.updateProposals(); return true; }
/** @return state */ public CommitMessageComponentState getState() { updateStateFromUI(); CommitMessageComponentState state = new CommitMessageComponentState(); state.setAmend(isAmending()); state.setAuthor(getAuthor()); // store text with platform specific line endings state.setCommitMessage(commitText.getText()); state.setCommitter(getCommitter()); state.setHeadCommit(getHeadCommit()); return state; }