From e8254039b15b1fd94599328be8180a6943b37cb7 Mon Sep 17 00:00:00 2001 From: Mathias Kinzler Date: Thu, 10 Jun 2010 10:29:09 +0200 Subject: [PATCH] Check for unsaved changes before Commit Before the commit dialog is opened, the user should be warned of unsaved changes and have the option to save the changes or abort the commit action. Bug: 315702 Change-Id: I61014d008159951e73bbc7fdc24334f2ae75eb2e Signed-off-by: Mathias Kinzler Signed-off-by: Matthias Sohn --- .../src/org/eclipse/egit/ui/internal/actions/CommitAction.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java index a92eab5e..b130c5be 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CommitAction.java @@ -58,6 +58,7 @@ import org.eclipse.osgi.util.NLS; import org.eclipse.team.core.Team; import org.eclipse.team.core.TeamException; import org.eclipse.team.internal.ui.Utils; +import org.eclipse.ui.PlatformUI; /** * Scan for modified resources in the same project as the selected resources. @@ -76,6 +77,12 @@ public class CommitAction extends RepositoryAction { @Override public void execute(IAction act) { + // let's see if there is any dirty editor around and + // ask the user if they want to save or abort + if (!PlatformUI.getWorkbench().saveAllEditors(true)) { + return; + } + resetState(); try { buildIndexHeadDiffList(); -- 2.11.4.GIT