diff options
author | Alexander Nittka | 2020-03-11 09:58:41 +0000 |
---|---|---|
committer | Thomas Wolf | 2020-04-04 10:15:16 +0000 |
commit | 0498bada02b90e1c5505cf21b7000278a5eaae91 (patch) | |
tree | 12a21ecc6be36bc01de63cf2e0f4129017cf3c9a /org.eclipse.egit.ui/src/org/eclipse/egit | |
parent | 4ca1dc20348c630b5c9cacecfda9233861e2834c (diff) | |
download | egit-0498bada02b90e1c5505cf21b7000278a5eaae91.tar.gz egit-0498bada02b90e1c5505cf21b7000278a5eaae91.tar.xz egit-0498bada02b90e1c5505cf21b7000278a5eaae91.zip |
[staging view ] commit button enablement
The commit button should be enabled only if there is something to
commit.
Bug: 525685
Change-Id: Ib5915668a0e96786c01e431f685fb4bce13aa613
Signed-off-by: Alexander Nittka <alex@nittka.de>
Diffstat (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit')
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java index e0b4d064c7..9532b6090e 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java @@ -954,6 +954,7 @@ public class StagingView extends ViewPart public void run() { commitMessageComponent.setAmendingButtonSelection(isChecked()); updateMessage(); + updateCommitButtons(); } }; amendPreviousCommitAction.setImageDescriptor(UIIcons.AMEND_COMMIT); @@ -1388,7 +1389,10 @@ public class StagingView extends ViewPart boolean indexDiffAvailable = indexDiffAvailable(indexDiff); boolean noConflicts = noConflicts(indexDiff); - boolean commitEnabled = noConflicts && indexDiffAvailable + boolean hasChange = amendPreviousCommitAction.isChecked() + || stagedViewer.getTree().getItemCount() > 0; + + boolean commitEnabled = noConflicts && indexDiffAvailable && hasChange && !isCommitBlocked(); boolean commitAndPushEnabled = commitAndPushEnabled(commitEnabled); @@ -1756,8 +1760,12 @@ public class StagingView extends ViewPart signedOffByAction.setEnabled(enabled); signCommitAction.setEnabled(enabled); addChangeIdAction.setEnabled(enabled); - commitButton.setEnabled(enabled); - commitAndPushButton.setEnabled(enabled); + if (enabled) { + updateCommitButtons(); + } else { + commitButton.setEnabled(enabled); + commitAndPushButton.setEnabled(enabled); + } } private void enableAuthorText(boolean enabled) { |