Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2019-12-23 10:22:06 +0000
committerThomas Wolf2019-12-24 14:27:03 +0000
commit24468cf1126fce9484019edc49cb1785e4d95c0c (patch)
tree6f8a3d92862e22a60a5fa375aa2b583fa4eaae19
parent2a132889d4eaf17e21c30c36704fb6f90b9b5ec3 (diff)
downloadegit-24468cf1126fce9484019edc49cb1785e4d95c0c.tar.gz
egit-24468cf1126fce9484019edc49cb1785e4d95c0c.tar.xz
egit-24468cf1126fce9484019edc49cb1785e4d95c0c.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 6065e20274..f3fa5ccc61 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 1d572c3f40..171774f3d6 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