From eaea49ca97365415d516073901c2335c84513149 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Sat, 23 Jun 2018 10:06:51 +0200 Subject: Disable commit buttons immediately on committing Since all the file related checks can take quite some time, we need to disable the buttons immediately, not only when triggering the commit operation on the repository. Most notable visible difference is that the complete staging view is disabled when the user gets the "no files staged" error message dialog. Change-Id: Iae825abfb9235832a3fae49e9f967d983461dec5 Signed-off-by: Michael Keppler Bug:533005 --- .../org/eclipse/egit/ui/internal/staging/StagingView.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal') 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 6395190e7c..d49184696d 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 @@ -4152,20 +4152,28 @@ public class StagingView extends ViewPart } private void commit(boolean pushUpstream) { + // don't allow to do anything as long as commit is in progress + enableAllWidgets(false); + if (!isCommitWithoutFilesAllowed()) { MessageDialog md = new MessageDialog(getSite().getShell(), UIText.StagingView_committingNotPossible, null, UIText.StagingView_noStagedFiles, MessageDialog.ERROR, new String[] { IDialogConstants.CLOSE_LABEL }, 0); md.open(); + enableAllWidgets(true); return; } - if (!commitMessageComponent.checkCommitInfo()) + if (!commitMessageComponent.checkCommitInfo()) { + enableAllWidgets(true); return; + } if (!UIUtils.saveAllEditors(currentRepository, - UIText.StagingView_cancelCommitAfterSaving)) + UIText.StagingView_cancelCommitAfterSaving)) { + enableAllWidgets(true); return; + } String commitMessage = commitMessageComponent.getCommitMessage(); CommitOperation commitOperation = null; @@ -4176,6 +4184,7 @@ public class StagingView extends ViewPart commitMessage); } catch (CoreException e) { Activator.handleError(UIText.StagingView_commitFailed, e, true); + enableAllWidgets(true); return; } if (amendPreviousCommitAction.isChecked()) @@ -4191,8 +4200,6 @@ public class StagingView extends ViewPart .setOpenCommitEditor(openNewCommitsAction.isChecked()) .setPushUpstream(pushMode); - // don't allow to do anything as long as commit is in progress - enableAllWidgets(false); commitJob.addJobChangeListener(new JobChangeAdapter() { @Override -- cgit v1.2.3