コード例 #1
0
  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);
  }
コード例 #2
0
 /** @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;
 }
コード例 #3
0
 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);
     }
   }
 }
コード例 #4
0
 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);
     }
   }
 }
コード例 #5
0
 /** @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();
 }
コード例 #6
0
 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);
 }
コード例 #7
0
 public void updateStateFromUI() {
   commitMessage = commitText.getText();
   author = authorText.getText().trim();
   committer = committerText.getText().trim();
 }