X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=91e19487f98348599e127ca989756fed18be207f;hb=d6ab7729d96fd22c5e733dbb0af998f8e6387200;hp=d2f3841e044404e1a3c664c3b0d6d72ce1849b78;hpb=45cdda84387bfd8b7383573f9788dd0dd6e70ecd;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index d2f3841..91e1948 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -234,7 +234,7 @@ public class Desktop extends GDesktop * object but no actual frames. Though not headless, this option disallows * dialogs to run in test environments. * - * It is set by invoking the Desktop(true) constructor. + * It is set by invoking Desktop.getInstanceOnly(). * */ boolean instanceOnly; @@ -380,17 +380,18 @@ public class Desktop extends GDesktop /** * For TestNG, this constructor can be utilized to allow the creation of a - * singleton Desktop instance without the formation of frames and, especially, - * not involving dialogs. Cache.log is also initialized for some tests that - * require it despite there being no Desktop. + * singleton Desktop instance with the creation of frames, but no addition to + * the Desktop object, as in headless mode. Dialogs are not initiated. + * Cache.log is also initialized for some tests that require it despite there + * being no Desktop. * - * @param forInstance */ - public Desktop(boolean forInstance) + public static Desktop getInstanceOnly() { - ApplicationSingletonProvider.setInstance(Desktop.class, this); - Cache.initLogger(); - instanceOnly = true; + Desktop d = (Desktop) ApplicationSingletonProvider + .getInstance(Desktop.class); + d.instanceOnly = true; + return d; } /** @@ -926,7 +927,7 @@ public class Desktop extends GDesktop } // THIS IS A PUBLIC STATIC METHOD, SO IT MAY BE CALLED EVEN IN // A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN - // IF JALVIEW IS RUNNING HEADLESS + // IF JALVIEW IS RUNNING HEADLESS OR IN INSTANCE-ONLY (testNG) MODE // /////////////////////////////////////////////// if (Jalview.isHeadlessMode() || Desktop.getInstance().instanceOnly) { @@ -3311,8 +3312,6 @@ public class Desktop extends GDesktop { } } - System.out.println("Desktop headless or instanceonly" + instanceOnly - + " " + Jalview.isHeadlessMode()); if (instanceOnly || Jalview.isHeadlessMode()) { return;