(discoverer, null);
+ new Thread(f).start();
+ tasks.add(f);
}
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
- t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer()
- .startDiscoverer(changeSupport);
+ tasks.add(jalview.ws.jws2.Jws2Discoverer.getInstance().startDiscoverer());
}
- Thread t3 = null;
+ if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true))
{
- // TODO: do rest service discovery
+ tasks.add(jalview.ws.slivkaws.SlivkaWSDiscoverer.getInstance().startDiscoverer());
}
if (blocking)
{
- while (alive)
- {
+ for (Future> task : tasks) {
try
{
- Thread.sleep(15);
+ // block until all discovery tasks are done
+ task.get();
} catch (Exception e)
{
+ e.printStackTrace();
}
- alive = (t1 != null && t1.isAlive()) || (t2 != null && t2.isAlive())
- || (t3 != null && t3.isAlive())
- || (t0 != null && t0.isAlive());
}
}
}
@@ -3062,8 +2762,10 @@ public class Desktop extends jalview.jbgui.GDesktop
{
if (evt.getNewValue() == null || evt.getNewValue() instanceof Vector)
{
- final String ermsg = jalview.ws.jws2.Jws2Discoverer.getDiscoverer()
- .getErrorMessages();
+ final WSDiscovererI discoverer = jalview.ws.jws2.Jws2Discoverer
+ .getInstance();
+ final String ermsg = discoverer.getErrorMessages();
+ // CONFLICT:ALT:? final String ermsg = jalview.ws.jws2.Jws2Discoverer.getInstance()
if (ermsg != null)
{
if (Cache.getDefault("SHOW_WSDISCOVERY_ERRORS", true))
@@ -3101,7 +2803,7 @@ public class Desktop extends jalview.jbgui.GDesktop
*
* jd.waitForInput();
*/
- JvOptionPane.showConfirmDialog(Desktop.desktop,
+ JvOptionPane.showConfirmDialog(desktopPane,
new JLabel(""
+ "It may be that you have invalid JABA URLs
in your web service preferences,"
@@ -3138,7 +2840,7 @@ public class Desktop extends jalview.jbgui.GDesktop
*/
public static void showUrl(final String url)
{
- showUrl(url, Desktop.instance);
+ showUrl(url, getInstance());
}
/**
@@ -3167,7 +2869,7 @@ public class Desktop extends jalview.jbgui.GDesktop
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(getDesktopPane(),
MessageManager
.getString("label.web_browser_not_found_unix"),
MessageManager.getString("label.web_browser_not_found"),
@@ -3207,7 +2909,7 @@ public class Desktop extends jalview.jbgui.GDesktop
try
{
url = e.getURL().toString();
- Desktop.showUrl(url);
+ showUrl(url);
} catch (Exception x)
{
if (url != null)
@@ -3265,9 +2967,8 @@ public class Desktop extends jalview.jbgui.GDesktop
} catch (InterruptedException x)
{
}
- ;
}
- if (instance == null)
+ if (Jalview.isHeadlessMode())
{
return;
}
@@ -3290,28 +2991,39 @@ public class Desktop extends jalview.jbgui.GDesktop
block.release();
}
+ /**
+ * Outputs an image of the desktop to file in EPS format, after prompting the
+ * user for choice of Text or Lineart character rendering (unless a preference
+ * has been set). The file name is generated as
+ *
+ *
+ * Jalview_snapshot_nnnnn.eps where nnnnn is the current timestamp in milliseconds
+ *
+ */
@Override
protected void snapShotWindow_actionPerformed(ActionEvent e)
{
+ // currently the menu option to do this is not shown
invalidate();
- File of;
- ImageMaker im = new jalview.util.ImageMaker(
- this, ImageMaker.TYPE.EPS, "View of Desktop", getWidth(),
- getHeight(), of = new File("Jalview_snapshot"
- + System.currentTimeMillis() + ".eps"),
- "View of desktop", null, 0, false);
- try
- {
- paintAll(im.getGraphics());
- im.writeImage();
- } catch (Exception q)
+
+ int width = getWidth();
+ int height = getHeight();
+ File of = new File(
+ "Jalview_snapshot_" + System.currentTimeMillis() + ".eps");
+ ImageWriterI writer = new ImageWriterI()
{
- Cache.log.error("Couldn't write snapshot to " + of.getAbsolutePath(),
- q);
- return;
- }
- Cache.log.info("Successfully written snapshot to file "
- + of.getAbsolutePath());
+ @Override
+ public void exportImage(Graphics g) throws Exception
+ {
+ paintAll(g);
+ Cache.log.info("Successfully written snapshot to file "
+ + of.getAbsolutePath());
+ }
+ };
+ String title = "View of desktop";
+ ImageExporter exporter = new ImageExporter(writer, null, TYPE.EPS,
+ title);
+ exporter.doExport(of, this, width, height, title);
}
/**
@@ -3382,7 +3094,7 @@ public class Desktop extends jalview.jbgui.GDesktop
{
splitFrame.setLocation(geometry.getLocation());
}
- Desktop.addInternalFrame(splitFrame, sf.getTitle(), -1, -1);
+ addInternalFrame(splitFrame, sf.getTitle(), -1, -1);
}
/*
@@ -3420,7 +3132,7 @@ public class Desktop extends jalview.jbgui.GDesktop
String topViewId = myTopFrame.viewport.getSequenceSetId();
String bottomViewId = myBottomFrame.viewport.getSequenceSetId();
- JInternalFrame[] frames = desktop.getAllFrames();
+ JInternalFrame[] frames = desktopPane.getAllFrames();
for (JInternalFrame frame : frames)
{
if (frame instanceof SplitFrame && frame != source)
@@ -3483,11 +3195,34 @@ public class Desktop extends jalview.jbgui.GDesktop
* - the payload from the drop event
* @throws Exception
*/
- public static void transferFromDropTarget(List files,
+ @SuppressWarnings("unchecked")
+ public static void transferFromDropTarget(List