();
}
if (progressBars.get(new Long(id)) != null)
{
- JPanel progressPanel = progressBars
- .remove(new Long(id));
+ JPanel progressPanel = progressBars.remove(new Long(id));
if (progressBarHandlers.contains(new Long(id)))
{
progressBarHandlers.remove(new Long(id));
@@ -2311,7 +2345,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
final JPanel progressPanel = (JPanel) progressBars.get(new Long(id));
if (handler.canCancel())
{
- JButton cancel = new JButton("Cancel");
+ JButton cancel = new JButton(MessageManager.getString("action.cancel"));
final IProgressIndicator us = this;
cancel.addActionListener(new ActionListener()
{
@@ -2406,7 +2440,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
boolean alive = true;
Thread t0 = null, t1 = null, t2 = null;
-
+ // JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release
+ if (true)
+ {
// todo: changesupport handlers need to be transferred
if (discoverer == null)
{
@@ -2414,29 +2450,33 @@ public class Desktop extends jalview.jbgui.GDesktop implements
// register PCS handler for desktop.
discoverer.addPropertyChangeListener(changeSupport);
}
- // JAL-940 - disabled JWS1 service configuration - always start discoverer until we phase out completely
- if (true)
- {
+ // JAL-940 - disabled JWS1 service configuration - always start discoverer
+ // until we phase out completely
(t0 = new Thread(discoverer)).start();
}
- try
+ // ENFIN services are EOLed as of Jalview 2.8.1 release
+ if (false)
{
- if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
+ try
{
- // EnfinEnvision web service menu entries are rebuild every time the
- // menu is shown, so no changeSupport events are needed.
- jalview.ws.EnfinEnvision2OneWay.getInstance();
- (t1 = new Thread(jalview.ws.EnfinEnvision2OneWay.getInstance()))
- .start();
+ if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
+ {
+ // EnfinEnvision web service menu entries are rebuild every time the
+ // menu is shown, so no changeSupport events are needed.
+ jalview.ws.EnfinEnvision2OneWay.getInstance();
+ (t1 = new Thread(jalview.ws.EnfinEnvision2OneWay.getInstance()))
+ .start();
+ }
+ } catch (Exception e)
+ {
+ Cache.log
+ .info("Exception when trying to launch Envision2 workflow discovery.",
+ e);
+ Cache.log.info(e.getStackTrace());
}
- } catch (Exception e)
- {
- Cache.log
- .info("Exception when trying to launch Envision2 workflow discovery.",
- e);
- Cache.log.info(e.getStackTrace());
}
+
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
if (jalview.ws.jws2.Jws2Discoverer.getDiscoverer().isRunning())
@@ -2445,9 +2485,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer().startDiscoverer(
changeSupport);
-
+
}
- Thread t3=null;
+ Thread t3 = null;
{
// TODO: do rest service discovery
}
@@ -2484,28 +2524,58 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
if (Cache.getDefault("SHOW_WSDISCOVERY_ERRORS", true))
{
- if (serviceChangedDialog == null)
- {
- // only run if we aren't already displaying one of these.
- javax.swing.SwingUtilities
- .invokeLater(serviceChangedDialog = new Runnable()
- {
- public void run()
- {
-
- JOptionPane
- .showInternalMessageDialog(
- Desktop.desktop,
- ermsg
- + "It may be that you have invalid JABA URLs\nin your web service preferences.\n\nGo to the Web services tab of the\nTools->Preferences dialog box to change them.\n",
- "Preferences Problem",
- JOptionPane.WARNING_MESSAGE);
- serviceChangedDialog = null;
-
- }
- });
+ if (serviceChangedDialog == null)
+ {
+ // only run if we aren't already displaying one of these.
+ addDialogThread(serviceChangedDialog = new Runnable()
+ {
+ public void run()
+ {
+
+ /*
+ * JalviewDialog jd =new JalviewDialog() {
+ *
+ * @Override protected void cancelPressed() { // TODO
+ * Auto-generated method stub
+ *
+ * }@Override protected void okPressed() { // TODO
+ * Auto-generated method stub
+ *
+ * }@Override protected void raiseClosed() { // TODO
+ * Auto-generated method stub
+ *
+ * } }; jd.initDialogFrame(new
+ * JLabel("" + ermsg +
+ * " It may be that you have invalid JABA URLs in your web service preferences,"
+ * + " or mis-configured HTTP proxy settings. " +
+ * "Check the Connections and Web services tab of the"
+ * +
+ * " Tools->Preferences dialog box to change them. |
"
+ * ), true, true, "Web Service Configuration Problem", 450,
+ * 400);
+ *
+ * jd.waitForInput();
+ */
+ JOptionPane
+ .showConfirmDialog(
+ Desktop.desktop,
+ new JLabel(
+ ""
+ + "It may be that you have invalid JABA URLs
in your web service preferences,"
+ + " or mis-configured HTTP proxy settings.
"
+ + "Check the Connections and Web services tab
of the"
+ + " Tools->Preferences dialog box to change them.
"),
+ "Web Service Configuration Problem",
+ JOptionPane.DEFAULT_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ serviceChangedDialog = null;
+
+ }
+ });
+ }
}
- }
else
{
Cache.log
@@ -2529,12 +2599,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
showUrl(url, Desktop.instance);
}
+
/**
* Like showUrl but allows progress handler to be specified
+ *
* @param url
- * @param progress (null) or object implementing IProgressIndicator
+ * @param progress
+ * (null) or object implementing IProgressIndicator
*/
- public static void showUrl(final String url, final IProgressIndicator progress)
+ public static void showUrl(final String url,
+ final IProgressIndicator progress)
{
new Thread(new Runnable()
{
@@ -2542,8 +2616,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
try
{
- if (progress!=null) {
- progress.setProgressBar("Opening "+url, this.hashCode());
+ if (progress != null)
+ {
+ progress.setProgressBar("Opening " + url, this.hashCode());
}
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
@@ -2558,7 +2633,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
ex.printStackTrace();
}
- if (progress!=null) {
+ if (progress != null)
+ {
progress.setProgressBar(null, this.hashCode());
}
}
@@ -2577,32 +2653,95 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
/**
- * static hyperlink handler proxy method for use by Jalview's internal windows
+ * static hyperlink handler proxy method for use by Jalview's internal windows
+ *
* @param e
*/
public static void hyperlinkUpdate(HyperlinkEvent e)
{
if (e.getEventType() == EventType.ACTIVATED)
{
- String url=null;
+ String url = null;
try
{
url = e.getURL().toString();
Desktop.showUrl(url);
} catch (Exception x)
{
- if (url!=null) {
- if (Cache.log!=null) {
- Cache.log.error("Couldn't handle string "+url+" as a URL.");
- } else {
- System.err.println("Couldn't handle string "+url+" as a URL.");
+ if (url != null)
+ {
+ if (Cache.log != null)
+ {
+ Cache.log.error("Couldn't handle string " + url + " as a URL.");
+ }
+ else
+ {
+ System.err.println("Couldn't handle string " + url
+ + " as a URL.");
}
}
// ignore any exceptions due to dud links.
}
- }
+ }
}
+ /**
+ * single thread that handles display of dialogs to user.
+ */
+ ExecutorService dialogExecutor = Executors.newSingleThreadExecutor();
+
+ /**
+ * flag indicating if dialogExecutor should try to acquire a permit
+ */
+ private volatile boolean dialogPause = true;
+ /**
+ * pause the queue
+ */
+ private java.util.concurrent.Semaphore block = new Semaphore(0);
+
+ /**
+ * add another dialog thread to the queue
+ *
+ * @param prompter
+ */
+ public void addDialogThread(final Runnable prompter)
+ {
+ dialogExecutor.submit(new Runnable()
+ {
+ public void run()
+ {
+ if (dialogPause)
+ {
+ try
+ {
+ block.acquire();
+ } catch (InterruptedException x)
+ {
+ }
+ ;
+ }
+ if (instance == null)
+ {
+ return;
+ }
+ try
+ {
+ SwingUtilities.invokeAndWait(prompter);
+ } catch (Exception q)
+ {
+ Cache.log.warn("Unexpected Exception in dialog thread.", q);
+ }
+ }
+ });
+ }
+
+ public void startDialogQueue()
+ {
+ // set the flag so we don't pause waiting for another permit and semaphore
+ // the current task to begin
+ dialogPause = false;
+ block.release();
+ }
}