public JInternalFrame PIDSlider;
- /**
- * just an instance (for testng, probably); no actual frames
- *
- * This flag, when set true, allows a headless-like operation, with a Desktop
- * object but no actual frames. The issue has to do with the mess-up of the
- * Windows JInternalFrame implementation, which surreptitiously and
- * unforgivingly accesses a native peer class, preventing headless operation.
- *
- * It is set by invoking the Desktop(true) constructor.
- *
- * It is possible that we can remove this option now, since headless mode is
- * finally working on Windows through careful attention to not creating any
- * JInternalFrame objects when in that mode.
- *
- */
- boolean instanceOnly;
-
class MyDesktopManager implements DesktopManager
{
: (Desktop) ApplicationSingletonProvider
.getInstance(Desktop.class);
}
-
- /**
- * 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.
- *
- * @param forInstance
- */
- public Desktop(boolean forInstance)
- {
- ApplicationSingletonProvider.setInstance(Desktop.class, this);
- Cache.initLogger();
- instanceOnly = true;
- }
/**
* Private constructor enforces singleton pattern. It is called by reflection
* from ApplicationSingletonProvider.getInstance().
*/
- @SuppressWarnings("unused")
private Desktop()
{
Cache.initLogger();
// it deletes the unneeded Java-only code form the JavaScript version
// completely (@j2sIgnore), since it will never be used there.
- if (!Platform.isJS())
+ if (!Platform.isJS() && !Jalview.isSynchronous())
/**
* Java only
*
// A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
// IF JALVIEW IS RUNNING HEADLESS
// ///////////////////////////////////////////////
- if (Jalview.isHeadlessMode() || Desktop.getInstance().instanceOnly)
+ if (Jalview.isHeadlessMode())
{
return;
}
{
try
{
- new Jalview2XML().loadJalviewAlign(choice);
+ new Jalview2XML().loadJalviewAlign(selectedFile);
} catch (OutOfMemoryError oom)
{
new OOMWarning("Whilst loading project from " + choice, oom);
{
}
}
- System.out.println("Desktop headless or instanceonly" + instanceOnly
- + " " + Jalview.isHeadlessMode());
- if (instanceOnly || Jalview.isHeadlessMode())
+ if (Jalview.isHeadlessMode())
{
return;
}