use of org.eclipse.egit.ui.internal.dialogs.CommitMessageComponentState in project egit by eclipse.
the class StagingView method updateCommitMessageComponent.
void updateCommitMessageComponent(boolean repositoryChanged, boolean indexDiffAvailable) {
if (repositoryChanged)
if (commitMessageComponent.isAmending() || userEnteredCommitMessage())
saveCommitMessageComponentState();
else
deleteCommitMessageComponentState();
if (!indexDiffAvailable)
// only try to restore the stored repo commit message if
return;
// indexDiff is ready
CommitHelper helper = new CommitHelper(currentRepository);
CommitMessageComponentState oldState = null;
if (repositoryChanged || commitMessageComponent.getRepository() != currentRepository) {
oldState = loadCommitMessageComponentState();
commitMessageComponent.setRepository(currentRepository);
if (oldState == null)
loadInitialState(helper);
else
loadExistingState(helper, oldState);
} else {
// repository did not change
if (!commitMessageComponent.getHeadCommit().equals(helper.getPreviousCommit()) || !commitMessageComponent.isAmending()) {
if (!commitMessageComponent.isAmending() && userEnteredCommitMessage())
addHeadChangedWarning(commitMessageComponent.getCommitMessage());
else
loadInitialState(helper);
}
}
amendPreviousCommitAction.setChecked(commitMessageComponent.isAmending());
amendPreviousCommitAction.setEnabled(helper.amendAllowed());
updateMessage();
}
Aggregations