From d7ac629472e9ad6be2c5ecff41b0b74751cd2844 Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Sun, 16 Oct 2016 20:31:16 -0400 Subject: [PATCH] Make sure shell is not disposed in closeSecondaryShells While running ProjectExplorerTracesFolderTest, it was noticed that closeSecondaryShells could try to close a disposed shell. This change fixes this and also makes the test call closeSecondaryShells after every test. Change-Id: I5172e676e1ac7d619f11e904c0ca0141102f9c71 Signed-off-by: Marc-Andre Laperle Reviewed-on: https://git.eclipse.org/r/83332 Reviewed-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- .../projectexplorer/ProjectExplorerTracesFolderTest.java | 9 +++++++++ .../tmf/ui/swtbot/tests/shared/SWTBotUtils.java | 1 + 2 files changed, 10 insertions(+) diff --git a/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java b/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java index 292d5936b5..e870b936f9 100644 --- a/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java +++ b/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java @@ -43,6 +43,7 @@ import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.ConditionHelpers; import org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotUtils; import org.eclipse.tracecompass.tmf.ui.tests.shared.WaitUtils; import org.eclipse.ui.IPageLayout; +import org.junit.After; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.FixMethodOrder; @@ -170,6 +171,14 @@ public class ProjectExplorerTracesFolderTest { fLogger.removeAllAppenders(); } + /** + * Test tear down method. + */ + @After + public void afterTest() { + SWTBotUtils.closeSecondaryShells(fBot); + } + private static void test3_01Preparation() { // FIXME: We can't use Manage Custom Parsers > Import because it uses a native dialog. We'll still check that they show up in the dialog CustomTxtTraceDefinition[] txtDefinitions = CustomTxtTraceDefinition.loadAll(getPath("customParsers/ExampleCustomTxtParser.xml")); diff --git a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java index b402c6b04e..e337fe93d1 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java @@ -284,6 +284,7 @@ public final class SWTBotUtils { // shell such the special "limbo shell" that Eclipse needs to work Arrays.stream(shells) .filter(shell -> shell != mainShell) + .filter(s -> !s.widget.isDisposed()) .filter(SWTBotShell::isVisible) .peek(shell -> log.debug(MessageFormat.format("Closing lingering shell with title {0}", shell.getText()))) .forEach(SWTBotShell::close); -- 2.34.1