From: Leif Åstrand Date: Wed, 5 Sep 2012 08:38:05 +0000 (+0300) Subject: Use main window as current UI if not already set #9443 X-Git-Tag: 7.0.0.beta1~191^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=65240f403416efc82fb5ff9efce682291d426e89;p=vaadin-framework.git Use main window as current UI if not already set #9443 --- diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java index e4e49391bb..9498534b4a 100644 --- a/server/src/com/vaadin/Application.java +++ b/server/src/com/vaadin/Application.java @@ -185,6 +185,11 @@ public class Application implements Terminal.ErrorListener, Serializable { throw new IllegalStateException( "mainWindow is attached to another application"); } + if (UI.getCurrent() == null) { + // Assume setting a main window from Application.init if there's + // no current UI -> set the main window as the current UI + UI.setCurrent(mainWindow); + } this.mainWindow = mainWindow; }