")
.append("Built: ")
.append(Cache.getDefault("BUILD_DATE", "unknown"))
@@ -1379,7 +1459,7 @@ public class Desktop extends jalview.jbgui.GDesktop
else if (!latestVersion.equals(Cache.getProperty("VERSION")))
{
boolean red = false;
- if (Cache.getProperty("VERSION").toLowerCase()
+ if (Cache.getProperty("VERSION").toLowerCase(Locale.ROOT)
.indexOf("automated build") == -1)
{
red = true;
@@ -1392,7 +1472,7 @@ public class Desktop extends jalview.jbgui.GDesktop
.append(Cache.getDefault("LATEST_VERSION", "..Checking.."))
.append(" is available for download from ")
.append(Cache.getDefault("www.jalview.org",
- "http://www.jalview.org"))
+ "https://www.jalview.org"))
.append(" !!");
if (red)
{
@@ -1403,6 +1483,8 @@ public class Desktop extends jalview.jbgui.GDesktop
message.append(Cache.getDefault("AUTHORFNAMES", DEFAULT_AUTHORS));
message.append(CITATION);
+ message.append("
");
+
return message.toString();
}
@@ -1416,7 +1498,7 @@ public class Desktop extends jalview.jbgui.GDesktop
{
if (Platform.isJS())
{
- BrowserLauncher.openURL("http://www.jalview.org/help.html");
+ BrowserLauncher.openURL("https://www.jalview.org/help.html");
}
else
/**
@@ -1489,17 +1571,16 @@ public class Desktop extends jalview.jbgui.GDesktop
protected void garbageCollect_actionPerformed(ActionEvent e)
{
// We simply collect the garbage
- Cache.log.debug("Collecting garbage...");
+ jalview.bin.Console.debug("Collecting garbage...");
System.gc();
- Cache.log.debug("Finished garbage collection.");
+ jalview.bin.Console.debug("Finished garbage collection.");
}
/*
* (non-Javadoc)
*
- * @see
- * jalview.jbgui.GDesktop#showMemusage_actionPerformed(java.awt.event.ActionEvent
- * )
+ * @see jalview.jbgui.GDesktop#showMemusage_actionPerformed(java.awt.event.
+ * ActionEvent )
*/
@Override
protected void showMemusage_actionPerformed(ActionEvent e)
@@ -1625,7 +1706,7 @@ public class Desktop extends jalview.jbgui.GDesktop
@Override
protected void preferences_actionPerformed(ActionEvent e)
{
- new Preferences();
+ Preferences.openPreferences();
}
/**
@@ -1681,16 +1762,17 @@ public class Desktop extends jalview.jbgui.GDesktop
setProgressBar(MessageManager.formatMessage(
"label.saving_jalview_project", new Object[]
{ chosenFile.getName() }), chosenFile.hashCode());
- Cache.setProperty("LAST_DIRECTORY",
- chosenFile.getParent());
+ Cache.setProperty("LAST_DIRECTORY", chosenFile.getParent());
// TODO catch and handle errors for savestate
// TODO prevent user from messing with the Desktop whilst we're saving
try
{
- boolean doBackup = BackupFiles.getEnabled();
- BackupFiles backupfiles = doBackup ? new BackupFiles(chosenFile) : null;
+ boolean doBackup = BackupFiles.getEnabled();
+ BackupFiles backupfiles = doBackup ? new BackupFiles(chosenFile)
+ : null;
- new Jalview2XML().saveState(doBackup ? backupfiles.getTempFile() : chosenFile);
+ new Jalview2XML().saveState(
+ doBackup ? backupfiles.getTempFile() : chosenFile);
if (doBackup)
{
@@ -1703,7 +1785,7 @@ public class Desktop extends jalview.jbgui.GDesktop
+ chosenFile.getName(), oom);
} catch (Exception ex)
{
- Cache.log.error("Problems whilst trying to save to "
+ jalview.bin.Console.error("Problems whilst trying to save to "
+ chosenFile.getName(), ex);
JvOptionPane.showMessageDialog(me,
MessageManager.formatMessage(
@@ -1716,7 +1798,7 @@ public class Desktop extends jalview.jbgui.GDesktop
setProgressBar(null, chosenFile.hashCode());
}
}).start();
- }
+ }
}
@Override
@@ -1747,8 +1829,10 @@ public class Desktop extends jalview.jbgui.GDesktop
"Jalview Project (old)" };
JalviewFileChooser chooser = new JalviewFileChooser(
Cache.getProperty("LAST_DIRECTORY"), suffix, desc,
- "Jalview Project", true, BackupFiles.getEnabled()); // last two booleans: allFiles,
- // allowBackupFiles
+ "Jalview Project", true, BackupFiles.getEnabled()); // last two
+ // booleans:
+ // allFiles,
+ // allowBackupFiles
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager.getString("label.restore_state"));
chooser.setResponseHandler(0, new Runnable()
@@ -1765,29 +1849,30 @@ public class Desktop extends jalview.jbgui.GDesktop
@Override
public void run()
{
- try
+ try
{
- new Jalview2XML().loadJalviewAlign(choice);
+ new Jalview2XML().loadJalviewAlign(selectedFile);
} catch (OutOfMemoryError oom)
- {
- new OOMWarning("Whilst loading project from " + choice, oom);
- } catch (Exception ex)
- {
- Cache.log.error(
- "Problems whilst loading project from " + choice, ex);
- JvOptionPane.showMessageDialog(Desktop.desktop,
- MessageManager.formatMessage(
- "label.error_whilst_loading_project_from",
- new Object[]
- { choice }),
- MessageManager.getString("label.couldnt_load_project"),
- JvOptionPane.WARNING_MESSAGE);
- }
+ {
+ new OOMWarning("Whilst loading project from " + choice, oom);
+ } catch (Exception ex)
+ {
+ jalview.bin.Console.error(
+ "Problems whilst loading project from " + choice, ex);
+ JvOptionPane.showMessageDialog(Desktop.desktop,
+ MessageManager.formatMessage(
+ "label.error_whilst_loading_project_from",
+ new Object[]
+ { choice }),
+ MessageManager
+ .getString("label.couldnt_load_project"),
+ JvOptionPane.WARNING_MESSAGE);
+ }
}
- }).start();
+ }, "Project Loader").start();
}
});
-
+
chooser.showOpenDialog(this);
}
@@ -1976,9 +2061,7 @@ public class Desktop extends jalview.jbgui.GDesktop
// FIXME: ideally should use UI interface API
FeatureSettings viewFeatureSettings = (af.featureSettings != null
- && af.featureSettings.isOpen())
- ? af.featureSettings
- : null;
+ && af.featureSettings.isOpen()) ? af.featureSettings : null;
Rectangle fsBounds = af.getFeatureSettingsGeometry();
for (int i = 0; i < size; i++)
{
@@ -1997,9 +2080,8 @@ public class Desktop extends jalview.jbgui.GDesktop
}
/*
- * Restore the view's last exploded frame geometry if known. Multiple
- * views from one exploded frame share and restore the same (frame)
- * position and size.
+ * Restore the view's last exploded frame geometry if known. Multiple views from
+ * one exploded frame share and restore the same (frame) position and size.
*/
Rectangle geometry = ap.av.getExplodedGeometry();
if (geometry != null)
@@ -2011,7 +2093,8 @@ public class Desktop extends jalview.jbgui.GDesktop
addInternalFrame(newaf, af.getTitle(), AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
- // and materialise a new feature settings dialog instance for the new alignframe
+ // and materialise a new feature settings dialog instance for the new
+ // alignframe
// (closes the old as if 'OK' was pressed)
if (ap == af.alignPanel && newaf.featureSettings != null
&& newaf.featureSettings.isOpen()
@@ -2029,9 +2112,9 @@ public class Desktop extends jalview.jbgui.GDesktop
/**
* Gather expanded views (separate AlignFrame's) with the same sequence set
- * identifier back in to this frame as additional views, and close the expanded
- * views. Note the expanded frames may themselves have multiple views. We take
- * the lot.
+ * identifier back in to this frame as additional views, and close the
+ * expanded views. Note the expanded frames may themselves have multiple
+ * views. We take the lot.
*
* @param source
*/
@@ -2083,11 +2166,11 @@ public class Desktop extends jalview.jbgui.GDesktop
}
// refresh the feature setting UI for the source frame if it exists
- if (source.featureSettings != null
- && source.featureSettings.isOpen())
+ if (source.featureSettings != null && source.featureSettings.isOpen())
{
source.showFeatureSettingsUI();
}
+
}
public JInternalFrame[] getAllFrames()
@@ -2189,12 +2272,12 @@ public class Desktop extends jalview.jbgui.GDesktop
/**
* Proxy class for JDesktopPane which optionally displays the current memory
- * usage and highlights the desktop area with a red bar if free memory runs low.
+ * usage and highlights the desktop area with a red bar if free memory runs
+ * low.
*
* @author AMW
*/
- public class MyDesktopPane extends JDesktopPane
- implements Runnable
+ public class MyDesktopPane extends JDesktopPane implements Runnable
{
private static final float ONE_MB = 1048576f;
@@ -2281,6 +2364,9 @@ public class Desktop extends jalview.jbgui.GDesktop
10, getHeight() - fm.getHeight());
}
}
+
+ // output debug scale message. Important for jalview.bin.HiDPISettingTest2
+ Desktop.debugScaleMessage(Desktop.getDesktop().getGraphics());
}
}
@@ -2377,7 +2463,7 @@ public class Desktop extends jalview.jbgui.GDesktop
openGroovyConsole();
} catch (Exception ex)
{
- Cache.log.error("Groovy Shell Creation failed.", ex);
+ jalview.bin.Console.error("Groovy Shell Creation failed.", ex);
JvOptionPane.showInternalMessageDialog(Desktop.desktop,
MessageManager.getString("label.couldnt_create_groovy_shell"),
@@ -2399,9 +2485,9 @@ public class Desktop extends jalview.jbgui.GDesktop
/*
* We allow only one console at a time, so that AlignFrame menu option
- * 'Calculate | Run Groovy script' is unambiguous.
- * Disable 'Groovy Console', and enable 'Run script', when the console is
- * opened, and the reverse when it is closed
+ * 'Calculate | Run Groovy script' is unambiguous. Disable 'Groovy Console', and
+ * enable 'Run script', when the console is opened, and the reverse when it is
+ * closed
*/
Window window = (Window) groovyConsole.getFrame();
window.addWindowListener(new WindowAdapter()
@@ -2424,21 +2510,24 @@ public class Desktop extends jalview.jbgui.GDesktop
((Window) groovyConsole.getFrame()).setVisible(true);
/*
- * if we got this far, enable 'Run Groovy' in AlignFrame menus
- * and disable opening a second console
+ * if we got this far, enable 'Run Groovy' in AlignFrame menus and disable
+ * opening a second console
*/
enableExecuteGroovy(true);
}
/**
- * Bind Ctrl/Cmd-Q to Quit - for reset as Groovy Console takes over this binding
- * when opened
+ * Bind Ctrl/Cmd-Q to Quit - for reset as Groovy Console takes over this
+ * binding when opened
*/
protected void addQuitHandler()
{
- getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
- .put(KeyStroke.getKeyStroke(KeyEvent.VK_Q,
- jalview.util.ShortcutKeyMaskExWrapper.getMenuShortcutKeyMaskEx()),
+ getRootPane()
+ .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
+ KeyStroke
+ .getKeyStroke(KeyEvent.VK_Q,
+ jalview.util.ShortcutKeyMaskExWrapper
+ .getMenuShortcutKeyMaskEx()),
"Quit");
getRootPane().getActionMap().put("Quit", new AbstractAction()
{
@@ -2459,8 +2548,8 @@ public class Desktop extends jalview.jbgui.GDesktop
public void enableExecuteGroovy(boolean enabled)
{
/*
- * disable opening a second Groovy console
- * (or re-enable when the console is closed)
+ * disable opening a second Groovy console (or re-enable when the console is
+ * closed)
*/
groovyShell.setEnabled(!enabled);
@@ -2489,8 +2578,6 @@ public class Desktop extends jalview.jbgui.GDesktop
@Override
public void setProgressBar(String message, long id)
{
- // Platform.timeCheck("Desktop " + message, Platform.TIME_MARK);
-
if (progressBars == null)
{
progressBars = new Hashtable<>();
@@ -2567,8 +2654,9 @@ public class Desktop extends jalview.jbgui.GDesktop
}
/**
- * This will return the first AlignFrame holding the given viewport instance. It
- * will break if there are more than one AlignFrames viewing a particular av.
+ * This will return the first AlignFrame holding the given viewport instance.
+ * It will break if there are more than one AlignFrames viewing a particular
+ * av.
*
* @param viewport
* @return alignFrame for viewport
@@ -2622,13 +2710,36 @@ public class Desktop extends jalview.jbgui.GDesktop
this.inBatchMode = inBatchMode;
}
+ /**
+ * start service discovery and wait till it is done
+ */
public void startServiceDiscovery()
{
startServiceDiscovery(false);
}
+ /**
+ * start service discovery threads - blocking or non-blocking
+ *
+ * @param blocking
+ */
public void startServiceDiscovery(boolean blocking)
{
+ startServiceDiscovery(blocking, false);
+ }
+
+ /**
+ * start service discovery threads
+ *
+ * @param blocking
+ * - false means call returns immediately
+ * @param ignore_SHOW_JWS2_SERVICES_preference
+ * - when true JABA services are discovered regardless of user's JWS2
+ * discovery preference setting
+ */
+ public void startServiceDiscovery(boolean blocking,
+ boolean ignore_SHOW_JWS2_SERVICES_preference)
+ {
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
@@ -2646,7 +2757,8 @@ public class Desktop extends jalview.jbgui.GDesktop
(t0 = new Thread(discoverer)).start();
}
- if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
+ if (ignore_SHOW_JWS2_SERVICES_preference
+ || Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer()
.startDiscoverer(changeSupport);
@@ -2699,24 +2811,19 @@ public class Desktop extends jalview.jbgui.GDesktop
/*
* JalviewDialog jd =new JalviewDialog() {
*
- * @Override protected void cancelPressed() { // TODO
- * Auto-generated method stub
+ * @Override protected void cancelPressed() { // TODO Auto-generated method stub
*
- * }@Override protected void okPressed() { // TODO
- * Auto-generated method stub
+ * }@Override protected void okPressed() { // TODO Auto-generated method stub
*
- * }@Override protected void raiseClosed() { // 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);
+ * "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();
*/
@@ -2738,7 +2845,7 @@ public class Desktop extends jalview.jbgui.GDesktop
}
else
{
- Cache.log.error(
+ jalview.bin.Console.error(
"Errors reported by JABA discovery service. Check web services preferences.\n"
+ ermsg);
}
@@ -2831,15 +2938,8 @@ public class Desktop extends jalview.jbgui.GDesktop
{
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.");
- }
+ jalview.bin.Console
+ .error("Couldn't handle string " + url + " as a URL.");
}
// ignore any exceptions due to dud links.
}
@@ -2894,7 +2994,8 @@ public class Desktop extends jalview.jbgui.GDesktop
SwingUtilities.invokeAndWait(prompter);
} catch (Exception q)
{
- Cache.log.warn("Unexpected Exception in dialog thread.", q);
+ jalview.bin.Console.warn("Unexpected Exception in dialog thread.",
+ q);
}
}
});
@@ -2933,7 +3034,7 @@ public class Desktop extends jalview.jbgui.GDesktop
public void exportImage(Graphics g) throws Exception
{
paintAll(g);
- Cache.log.info("Successfully written snapshot to file "
+ jalview.bin.Console.info("Successfully written snapshot to file "
+ of.getAbsolutePath());
}
};
@@ -2945,8 +3046,8 @@ public class Desktop extends jalview.jbgui.GDesktop
/**
* Explode the views in the given SplitFrame into separate SplitFrame windows.
- * This respects (remembers) any previous 'exploded geometry' i.e. the size and
- * location last time the view was expanded (if any). However it does not
+ * This respects (remembers) any previous 'exploded geometry' i.e. the size
+ * and location last time the view was expanded (if any). However it does not
* remember the split pane divider location - this is set to match the
* 'exploding' frame.
*
@@ -2967,16 +3068,15 @@ public class Desktop extends jalview.jbgui.GDesktop
}
/*
- * Processing in reverse order works, forwards order leaves the first panels
- * not visible. I don't know why!
+ * Processing in reverse order works, forwards order leaves the first panels not
+ * visible. I don't know why!
*/
for (int i = viewCount - 1; i >= 0; i--)
{
/*
- * Make new top and bottom frames. These take over the respective
- * AlignmentPanel objects, including their AlignmentViewports, so the
- * cdna/protein relationships between the viewports is carried over to the
- * new split frames.
+ * Make new top and bottom frames. These take over the respective AlignmentPanel
+ * objects, including their AlignmentViewports, so the cdna/protein
+ * relationships between the viewports is carried over to the new split frames.
*
* explodedGeometry holds the (x, y) position of the previously exploded
* SplitFrame, and the (width, height) of the AlignFrame component
@@ -3015,8 +3115,8 @@ public class Desktop extends jalview.jbgui.GDesktop
}
/*
- * Clear references to the panels (now relocated in the new SplitFrames)
- * before closing the old SplitFrame.
+ * Clear references to the panels (now relocated in the new SplitFrames) before
+ * closing the old SplitFrame.
*/
topPanels.clear();
bottomPanels.clear();
@@ -3117,26 +3217,6 @@ public class Desktop extends jalview.jbgui.GDesktop
Transferable t) throws Exception
{
- // BH 2018 changed List to List