You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2021/06/20 13:56:41 UTC

[directory-studio] branch master updated: Close open shells/dialogs/wizards and fix an invalid thread access

This is an automated email from the ASF dual-hosted git repository.

seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-studio.git


The following commit(s) were added to refs/heads/master by this push:
     new f5a228c  Close open shells/dialogs/wizards and fix an invalid thread access
f5a228c is described below

commit f5a228cfc7c23fadbeaca600768f756311bc5ae6
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Sun Jun 20 15:56:28 2021 +0200

    Close open shells/dialogs/wizards and fix an invalid thread access
---
 .../directory/studio/test/integration/ui/AbstractTestBase.java    | 7 +++++--
 .../directory/studio/test/integration/ui/bots/StudioBot.java      | 8 ++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java
index 7978ed9..0fc7497 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/AbstractTestBase.java
@@ -44,6 +44,7 @@ import org.apache.directory.studio.test.integration.ui.bots.SearchLogsViewBot;
 import org.apache.directory.studio.test.integration.ui.bots.StudioBot;
 import org.apache.directory.studio.test.integration.ui.utils.Assertions;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
 import org.eclipse.swtbot.swt.finder.junit5.SWTBotJunit5Extension;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
@@ -74,8 +75,10 @@ public class AbstractTestBase
         searchLogsViewBot = studioBot.getSearchLogsViewBot();
         modificationLogsViewBot = studioBot.getModificationLogsViewBot();
         serversViewBot = studioBot.getApacheDSServersViewBot();
-        BrowserCorePlugin.getDefault()
-            .getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_LDIF_LINE_WIDTH, 1000 );
+        UIThreadRunnable.syncExec( () -> {
+            BrowserCorePlugin.getDefault()
+                .getPluginPreferences().setValue( BrowserCoreConstants.PREFERENCE_LDIF_LINE_WIDTH, 1000 );
+        } );
     }
 
 
diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
index f781dab..ce9848b 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java
@@ -183,6 +183,14 @@ public class StudioBot
                     }
 
                     // close shells (open dialogs)
+                    Shell[] shells = Display.getCurrent().getShells();
+                    for ( Shell shell : shells )
+                    {
+                        if ( shell != null && shell != window.getShell() )
+                        {
+                            shell.close();
+                        }
+                    }
                     Shell activeShell = Display.getCurrent().getActiveShell();
                     if ( activeShell != null && activeShell != window.getShell() )
                     {