import jalview.util.ShortcutKeyMaskExWrapper;
import jalview.util.UrlConstants;
import jalview.viewmodel.AlignmentViewport;
+import jalview.ws.WSDiscovererI;
import jalview.ws.params.ParamManager;
import jalview.ws.utils.UrlDownloadClient;
return;
}
- AlignmentViewport source = null, target = null;
+ AlignViewportI source = null;
+ AlignViewportI target = null;
if (frames[0] instanceof AlignFrame)
{
source = ((AlignFrame) frames[0]).getCurrentView();
{
try
{
- new Jalview2XML().loadJalviewAlign(choice);
+ new Jalview2XML().loadJalviewAlign(selectedFile);
} catch (OutOfMemoryError oom)
{
new OOMWarning("Whilst loading project from " + choice, oom);
public void startServiceDiscovery(boolean blocking)
{
boolean alive = true;
- Thread t0 = null, t1 = null, t2 = null;
+ Thread t0 = null, t1 = null, t2 = null, t3 = null;
// JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release
if (true)
{
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
- t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer()
- .startDiscoverer(changeSupport);
+ t2 = startServiceDiscovery(
+ jalview.ws.jws2.Jws2Discoverer.getDiscoverer(), false);
}
- Thread t3 = null;
+ if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true))
{
- // TODO: do rest service discovery
+ // start slivka discovery
+ t3 = startServiceDiscovery(
+ jalview.ws.slivkaws.SlivkaWSDiscoverer.getInstance(), false);
}
if (blocking)
{
} catch (Exception e)
{
}
+ // FIXME: Condition should check the discoverer's isRunning rather than
+ // threads
alive = (t1 != null && t1.isAlive()) || (t2 != null && t2.isAlive())
- || (t3 != null && t3.isAlive())
- || (t0 != null && t0.isAlive());
+ || (t3 != null && t3.isAlive()) || (t0 != null && t0.isAlive());
}
}
}
+ public Thread startServiceDiscovery(WSDiscovererI discoverer,
+ boolean blocking)
+ {
+ Thread thread = discoverer.startDiscoverer(changeSupport);
+ if (blocking)
+ {
+ try
+ {
+ thread.join();
+ } catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return thread;
+ }
+
/**
* called to check if the service discovery process completed successfully.
*
{
if (evt.getNewValue() == null || evt.getNewValue() instanceof Vector)
{
- final String ermsg = jalview.ws.jws2.Jws2Discoverer.getDiscoverer()
- .getErrorMessages();
+ final WSDiscovererI discoverer = jalview.ws.jws2.Jws2Discoverer
+ .getDiscoverer();
+ final String ermsg = discoverer.getErrorMessages();
if (ermsg != null)
{
if (Cache.getDefault("SHOW_WSDISCOVERY_ERRORS", true))