aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2010-08-31 09:47:09 -0400
committerJens Baumgart2010-08-31 09:47:09 -0400
commitd1877a91a7991b381e4e51528520d35ae6a3dbac (patch)
tree84a93ef0391e394a2fdd3510b71878bafe1ff55b
parenta0afa5b7cf320872a5976e6f1c5df2d41489a18e (diff)
downloadegit-d1877a91a7991b381e4e51528520d35ae6a3dbac.zip
egit-d1877a91a7991b381e4e51528520d35ae6a3dbac.tar.gz
egit-d1877a91a7991b381e4e51528520d35ae6a3dbac.tar.xz
Fix bugs in MergeActionHandler
1. Add missing scheduling rule to execution job. 2. The information dialog sometimes closed automatically. This was caused by the usage of the wrong parent shell. Change-Id: I0764c163cb643d68a3013801eba5a82e08ad8dc7 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MergeActionHandler.java40
1 files changed, 18 insertions, 22 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MergeActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MergeActionHandler.java
index 0dbce0f..e4721b6 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MergeActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/MergeActionHandler.java
@@ -34,6 +34,8 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryState;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
/**
* Action for selecting a commit and merging it with the current branch.
@@ -68,6 +70,7 @@ public class MergeActionHandler extends RepositoryActionHandler {
}
};
job.setUser(true);
+ job.setRule(op.getSchedulingRule());
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent cevent) {
@@ -75,18 +78,16 @@ public class MergeActionHandler extends RepositoryActionHandler {
if (result.getSeverity() == IStatus.CANCEL) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- try {
- MessageDialog
- .openInformation(
- getShell(event),
- UIText.MergeAction_MergeCanceledTitle,
- UIText.MergeAction_MergeCanceledMessage);
- } catch (ExecutionException e) {
- Activator
- .handleError(
- UIText.MergeAction_MergeCanceledMessage,
- null, true);
- }
+ // don't use getShell(event) here since
+ // the active shell has changed since the
+ // execution has been triggered.
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ MessageDialog
+ .openInformation(
+ shell,
+ UIText.MergeAction_MergeCanceledTitle,
+ UIText.MergeAction_MergeCanceledMessage);
}
});
} else if (!result.isOK()) {
@@ -95,16 +96,11 @@ public class MergeActionHandler extends RepositoryActionHandler {
} else {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- try {
- MessageDialog
- .openInformation(
- getShell(event),
- UIText.MergeAction_MergeResultTitle,
- op.getResult().toString());
- } catch (ExecutionException e) {
- Activator.handleError(op.getResult()
- .toString(), null, true);
- }
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
+ MessageDialog.openInformation(shell,
+ UIText.MergeAction_MergeResultTitle, op
+ .getResult().toString());
}
});
}