private void updateChangeIdButton() { String curText = commitText.getText(); if (!curText.endsWith(Text.DELIMITER)) curText += Text.DELIMITER; createChangeId = curText.indexOf(Text.DELIMITER + "Change-Id: ") != -1; // $NON-NLS-1$ listener.updateChangeIdToggleSelection(createChangeId); }
/** @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; }
private void refreshChangeIdText() { if (createChangeId) { // ChangeIdUtil uses \n line endings String text = commitText.getText().replaceAll(Text.DELIMITER, "\n"); // $NON-NLS-1$ String changedText = ChangeIdUtil.insertId( text, originalChangeId != null ? originalChangeId : ObjectId.zeroId(), true); if (!text.equals(changedText)) { changedText = changedText.replaceAll("\n", Text.DELIMITER); // $NON-NLS-1$ commitText.setText(changedText); } } else { String text = commitText.getText(); int changeIdOffset = findOffsetOfChangeIdLine(text); if (changeIdOffset > 0) { String cleanedText; int endOfChangeId = findNextEOL(changeIdOffset, text); if (endOfChangeId == -1) cleanedText = text.substring(0, changeIdOffset); else cleanedText = text.substring(0, changeIdOffset) + text.substring(endOfChangeId); commitText.setText(cleanedText); } } }
private void refreshSignedOffBy() { String curText = commitText.getText(); if (signedOff) // add signed off line commitText.setText(signOff(curText)); else { // remove signed off line String s = getSignedOff(); if (s != null) { curText = replaceSignOff(curText, s, EMPTY_STRING); if (curText.endsWith(Text.DELIMITER + Text.DELIMITER)) curText = curText.substring(0, curText.length() - Text.DELIMITER.length()); commitText.setText(curText); } } }
/** @param selection */ public void setAmendingButtonSelection(boolean selection) { amending = selection; if (!selection) { originalChangeId = null; authorText.setText(author); commitText.setText(commitMessageBeforeAmending); commitMessageBeforeAmending = EMPTY_STRING; } else { getHeadCommitInfo(); saveOriginalChangeId(); commitMessageBeforeAmending = commitText.getText(); commitText.setText(previousCommitMessage); if (previousAuthor != null) authorText.setText(previousAuthor); } refreshChangeIdText(); }
private void updateSignedOffButton() { String curText = commitText.getText(); if (!curText.endsWith(Text.DELIMITER)) curText += Text.DELIMITER; signedOff = curText.indexOf(getSignedOff() + Text.DELIMITER) != -1; listener.updateSignedOffToggleSelection(signedOff); }
public void updateStateFromUI() { commitMessage = commitText.getText(); author = authorText.getText().trim(); committer = committerText.getText().trim(); }