Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2019-12-23 10:22:06 +0000
committerThomas Wolf2019-12-23 11:36:13 +0000
commit151dbb8d8e088004fc3c16d9ceaa5a5ec998e5a6 (patch)
treee60e5cfc6eb98fe22cc838a34ad435816faecfb5
parent3514dc0efd4b876bf8772cbcc4566adf655de201 (diff)
downloadegit-151dbb8d8e088004fc3c16d9ceaa5a5ec998e5a6.tar.gz
egit-151dbb8d8e088004fc3c16d9ceaa5a5ec998e5a6.tar.xz
egit-151dbb8d8e088004fc3c16d9ceaa5a5ec998e5a6.zip
[ref filters] Prevent exception on canceling the dialog
When the dialog was canceled while an inline editor was open a "widget is disposed" exception occurred. Prevent that by checking explicitly. Change-Id: I22aff34a68219655e0068ee6c8fe8590b10bcf7e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/GitHistoryRefFilterConfigurationDialogTest.java16
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryRefFilterConfigurationDialog.java3
2 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/GitHistoryRefFilterConfigurationDialogTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/GitHistoryRefFilterConfigurationDialogTest.java
index 6065e2027..f3fa5ccc6 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/GitHistoryRefFilterConfigurationDialogTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/GitHistoryRefFilterConfigurationDialogTest.java
@@ -42,6 +42,7 @@ import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
@@ -718,6 +719,21 @@ public class GitHistoryRefFilterConfigurationDialogTest
}
@Test
+ public void testCancelWhileEditing() throws Exception {
+ SWTBotTable table = dialogBot.bot().table();
+ table.getTableItem(5).select();
+ click(UIText.GitHistoryPage_filterRefDialog_button_edit);
+
+ bot.text(0).setText("edited");
+
+ clickCancel();
+ bot.waitUntil(Conditions.shellCloses(dialogBot));
+
+ verify(refFilterHelper, Mockito.never())
+ .setRefFilters(ArgumentMatchers.any());
+ }
+
+ @Test
public void testCancelAfterButtonHead() throws Exception {
click(UIText.GitHistoryPage_filterRefDialog_button_headOnly);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryRefFilterConfigurationDialog.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryRefFilterConfigurationDialog.java
index 1d572c3f4..171774f3d 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryRefFilterConfigurationDialog.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryRefFilterConfigurationDialog.java
@@ -393,6 +393,9 @@ public class GitHistoryRefFilterConfigurationDialog
}
private void setMessage(String text) {
+ if (message.isDisposed()) {
+ return;
+ }
if (text == null) {
message.setImage(null);
message.setText(

Back to the top