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. Though not headless, this option disallows
- * dialogs to run in test environments.
- *
- * It is set by invoking Desktop.getInstanceOnly().
- *
- */
- 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 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.
- *
- */
- public static Desktop getInstanceOnly()
- {
- Desktop d = (Desktop) ApplicationSingletonProvider
- .getInstance(Desktop.class);
- d.instanceOnly = true;
- return d;
- }
/**
* 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
*
}
- this.setDropTarget(new java.awt.dnd.DropTarget(desktopPane, this));
-
- this.addWindowListener(new WindowAdapter()
+ if (!Jalview.isSynchronous())
{
- @Override
- public void windowClosing(WindowEvent evt)
- {
- quit();
- }
- });
+ this.setDropTarget(new java.awt.dnd.DropTarget(desktopPane, this));
- MouseAdapter ma;
- this.addMouseListener(ma = new MouseAdapter()
- {
- @Override
- public void mousePressed(MouseEvent evt)
+ this.addWindowListener(new WindowAdapter()
{
- if (evt.isPopupTrigger()) // Mac
+ @Override
+ public void windowClosing(WindowEvent evt)
{
- showPasteMenu(evt.getX(), evt.getY());
+ quit();
}
- }
+ });
- @Override
- public void mouseReleased(MouseEvent evt)
+ MouseAdapter ma;
+ this.addMouseListener(ma = new MouseAdapter()
{
- if (evt.isPopupTrigger()) // Windows
+ @Override
+ public void mousePressed(MouseEvent evt)
{
- showPasteMenu(evt.getX(), evt.getY());
+ if (evt.isPopupTrigger()) // Mac
+ {
+ showPasteMenu(evt.getX(), evt.getY());
+ }
}
- }
- });
- desktopPane.addMouseListener(ma);
+
+ @Override
+ public void mouseReleased(MouseEvent evt)
+ {
+ if (evt.isPopupTrigger()) // Windows
+ {
+ showPasteMenu(evt.getX(), evt.getY());
+ }
+ }
+ });
+ desktopPane.addMouseListener(ma);
+ }
} catch (Throwable t)
{
t.printStackTrace();
}
// 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 OR IN INSTANCE-ONLY (testNG) MODE
+ // 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);
{
}
}
- if (instanceOnly || Jalview.isHeadlessMode())
+ if (Jalview.isHeadlessMode())
{
return;
}