Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2013-04-12 12:25:36 +0000
committerRobin Stocker2013-04-19 14:51:35 +0000
commit1ed1e8c52fdb8c49b5b50163521233a8202a8df6 (patch)
treed5e17f3eaec15052fded0d05d75ab17823b26160 /org.eclipse.egit.ui
parent37d9d682edcb30bdc835da79ec08fa40638d5d14 (diff)
downloadegit-1ed1e8c52fdb8c49b5b50163521233a8202a8df6.tar.gz
egit-1ed1e8c52fdb8c49b5b50163521233a8202a8df6.tar.xz
egit-1ed1e8c52fdb8c49b5b50163521233a8202a8df6.zip
Don't access disposed widget in StashCreateUI.showNoChangesToStash()
The method is called from the job and the original shell may not be there anymore in case of showing this from the branch checkout dialog. Bug: 389866 Change-Id: Idf7480a823fa84b684c00648a664ad3dac15cd70
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchResultDialog.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/StashCreateCommand.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/stash/StashCreateUI.java19
3 files changed, 15 insertions, 12 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchResultDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchResultDialog.java
index 4598c0b532..76a20fc81e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchResultDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/branch/BranchResultDialog.java
@@ -152,8 +152,8 @@ public class BranchResultDialog extends MessageDialog {
shouldCheckout = true;
break;
case IDialogConstants.SKIP_ID:
- StashCreateUI stashCreateUI = new StashCreateUI(getShell(), repository);
- shouldCheckout = stashCreateUI.createStash();
+ StashCreateUI stashCreateUI = new StashCreateUI(repository);
+ shouldCheckout = stashCreateUI.createStash(getShell());
break;
case IDialogConstants.CANCEL_ID:
super.buttonPressed(buttonId);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/StashCreateCommand.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/StashCreateCommand.java
index 1b34bebda7..7b760c16c2 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/StashCreateCommand.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/tree/command/StashCreateCommand.java
@@ -40,8 +40,8 @@ public class StashCreateCommand extends
return null;
final Shell shell = HandlerUtil.getActiveShell(event);
- StashCreateUI stashCreateUI = new StashCreateUI(shell, repo);
- stashCreateUI.createStash();
+ StashCreateUI stashCreateUI = new StashCreateUI(repo);
+ stashCreateUI.createStash(shell);
return null;
}
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/stash/StashCreateUI.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/stash/StashCreateUI.java
index 73c6c81b60..77e046e83e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/stash/StashCreateUI.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/stash/StashCreateUI.java
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2012 GitHub Inc.
+ * Copyright (c) 2012, 2013 GitHub Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,28 +25,29 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
/**
* The UI wrapper for {@link StashCreateOperation} */
public class StashCreateUI {
private Repository repo;
- private Shell shell;
/**
- * @param shell
* @param repo
*/
- public StashCreateUI(Shell shell, Repository repo) {
- this.shell = shell;
+ public StashCreateUI(Repository repo) {
this.repo = repo;
}
/**
+ * @param shell
+ * the shell to use for showing the message input dialog
* @return true if a stash create operation was triggered
*/
- public boolean createStash() {
+ public boolean createStash(Shell shell) {
InputDialog commitMessageDialog = new InputDialog(shell,
UIText.StashCreateCommand_titleEnterCommitMessage,
UIText.StashCreateCommand_messageEnterCommitMessage,
@@ -89,10 +90,12 @@ public class StashCreateUI {
}
- private void showNoChangesToStash() {
- shell.getDisplay().asyncExec(new Runnable() {
+ private static void showNoChangesToStash() {
+ Display.getDefault().asyncExec(new Runnable() {
public void run() {
+ Shell shell = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell();
MessageDialog.openInformation(shell,
UIText.StashCreateCommand_titleNoChanges,
UIText.StashCreateCommand_messageNoChanges);

Back to the top