diff options
| author | Jens Baumgart | 2010-09-01 08:54:00 +0000 |
|---|---|---|
| committer | Jens Baumgart | 2010-09-01 08:54:00 +0000 |
| commit | 951605b66dd26bddc80c04568923a239eab66485 (patch) | |
| tree | babd02fd920ab7499441108ec91e7ecdd8dc3bea | |
| parent | 80ba015267932d62692d24b680e0b8218eb0db51 (diff) | |
| download | egit-951605b66dd26bddc80c04568923a239eab66485.tar.gz egit-951605b66dd26bddc80c04568923a239eab66485.tar.xz egit-951605b66dd26bddc80c04568923a239eab66485.zip | |
Fix bugs in MergeCommand
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: I12b7e6c214726b4b54b6bacf3b4a0fc1cfe96adf
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
| -rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/MergeCommand.java | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/MergeCommand.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/MergeCommand.java index 569f57f470..0f8705e40f 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/MergeCommand.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/MergeCommand.java @@ -37,6 +37,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; /** * Implements "Merge" @@ -95,6 +97,7 @@ public class MergeCommand extends } }; job.setUser(true); + job.setRule(op.getSchedulingRule()); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent jobEvent) { @@ -102,18 +105,14 @@ public class MergeCommand extends if (result.getSeverity() == IStatus.CANCEL) { Display.getDefault().asyncExec(new Runnable() { public void run() { - try { - MessageDialog - .openInformation( - getActiveShell(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()) { @@ -122,15 +121,11 @@ public class MergeCommand extends } else { Display.getDefault().asyncExec(new Runnable() { public void run() { - try { - MessageDialog.openInformation( - getActiveShell(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()); } }); } |
