Make sure shell is not disposed in closeSecondaryShells
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 17 Oct 2016 00:31:16 +0000 (20:31 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 17 Oct 2016 13:51:32 +0000 (09:51 -0400)
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 <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/83332
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java

index 292d5936b5a03e62e93609fefde0f8b20412d6ce..e870b936f926b9a61c1e6c4b82bce3eaa1922438 100644 (file)
@@ -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"));
index b402c6b04e2b57d1c3c0ab85ce579b75f94297de..e337fe93d18aff0810e5edf077723b6a3097d1e4 100644 (file)
@@ -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);
This page took 0.027457 seconds and 5 git commands to generate.