diff options
author | Thomas Wolf | 2019-12-23 10:22:06 +0000 |
---|---|---|
committer | Thomas Wolf | 2019-12-24 14:27:03 +0000 |
commit | 24468cf1126fce9484019edc49cb1785e4d95c0c (patch) | |
tree | 6f8a3d92862e22a60a5fa375aa2b583fa4eaae19 | |
parent | 2a132889d4eaf17e21c30c36704fb6f90b9b5ec3 (diff) | |
download | egit-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>
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( |