[test] Try to fix unreliable NoteCreationTest

Sometimes NoteCreationTest fails during the teardown during the refresh
of the Outline view. This commit reopen the Outline view after the
closing of the editor. This should avoid refresh problems.

Change-Id: I8cbdb7a555c4d15b5a9cc7bdbd3bdabd165a57ed
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/NoteCreationTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/NoteCreationTest.java
index 09c0dc5..1ff6134 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/NoteCreationTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/NoteCreationTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2020 THALES GLOBAL SERVICES.
  * This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License 2.0
  * which accompanies this distribution, and is available at
@@ -57,6 +57,7 @@
 import org.eclipse.sirius.viewpoint.description.Viewpoint;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
 import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
 import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
@@ -124,10 +125,14 @@
         editor.zoom(ZoomLevel.ZOOM_100);
         // Go to the origin to avoid scroll bar
         editor.scrollTo(0, 0);
-        // Reopen outline
-        new DesignerViews(bot).openOutlineView();
+        editor.close();
         SWTBotUtils.waitAllUiEvents();
+        // Keep a reference to the bot (the bot class field will be cleaned by "super.tearDown();")
+        SWTGefBot localBotRef = bot;
         super.tearDown();
+        // Reopen outline after the closing of the editor to avoid potential refresh problems with this view
+        new DesignerViews(localBotRef).openOutlineView();
+        SWTBotUtils.waitAllUiEvents();
     }
 
     /**