X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=429a2c149356527c8f081d6eb1b7add66b44518b;hb=7d92d3994908aae709e7c85cc5e1a1c4775907ed;hp=67ef9526543edf680b0c41c6024bdb723f7a4d0c;hpb=493683c2e262e0e22d642aec16e655be61790330;p=jalview.git
diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java
index 67ef952..429a2c1 100644
--- a/src/jalview/gui/Desktop.java
+++ b/src/jalview/gui/Desktop.java
@@ -20,6 +20,8 @@
*/
package jalview.gui;
+import java.util.Locale;
+
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@@ -138,24 +140,32 @@ import jalview.ws.utils.UrlDownloadClient;
public class Desktop extends jalview.jbgui.GDesktop
implements DropTargetListener, ClipboardOwner, IProgressIndicator, jalview.api.StructureSelectionManagerProvider {
private static final String CITATION;
- static {
- URL bg_logo_url = ChannelProperties.getImageURL("bg_logo." + String.valueOf(SplashScreen.logoSize));
- URL uod_logo_url = ChannelProperties.getImageURL("uod_banner." + String.valueOf(SplashScreen.logoSize));
+ static
+ {
+ URL bg_logo_url = ChannelProperties.getImageURL(
+ "bg_logo." + String.valueOf(SplashScreen.logoSize));
+ URL uod_logo_url = ChannelProperties.getImageURL(
+ "uod_banner." + String.valueOf(SplashScreen.logoSize));
boolean logo = (bg_logo_url != null || uod_logo_url != null);
StringBuilder sb = new StringBuilder();
- sb.append("
Development managed by The Barton Group, University of Dundee, Scotland, UK.");
- if (logo) {
+ sb.append(
+ "
Jalview is free software released under GPLv3.
Development is managed by The Barton Group, University of Dundee, Scotland, UK.");
+ if (logo)
+ {
sb.append("
");
}
- sb.append(bg_logo_url == null ? "" : "");
+ sb.append(bg_logo_url == null ? ""
+ : "");
sb.append(uod_logo_url == null ? ""
- : " ");
+ : " ");
sb.append(
- "
For help, see the FAQ at www.jalview.org/faq and/or join the jalview-discuss@jalview.org mailing list");
+ "
For help, see www.jalview.org/faq and join discourse.jalview.org");
sb.append("
If you use Jalview, please cite:"
- + "
Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
- + "
Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
- + "
Bioinformatics doi: 10.1093/bioinformatics/btp033");
+ + "
Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
+ + "
Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
+ + "
Bioinformatics doi: 10.1093/bioinformatics/btp033");
CITATION = sb.toString();
}
@@ -380,11 +390,11 @@ public class Desktop extends jalview.jbgui.GDesktop
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(xToolkit, title);
} else {
- Cache.log.debug("XToolkit: awtAppClassName not found");
+ jalview.bin.Console.debug("XToolkit: awtAppClassName not found");
}
} catch (Exception e) {
- Cache.debug("Error setting awtAppClassName");
- Cache.trace(Cache.getStackTraceString(e));
+ jalview.bin.Console.debug("Error setting awtAppClassName");
+ jalview.bin.Console.trace(Cache.getStackTraceString(e));
}
}
@@ -399,8 +409,8 @@ public class Desktop extends jalview.jbgui.GDesktop
System.out.println("Cannot set APQHandlers");
// e.printStackTrace();
} catch (Throwable t) {
- Cache.warn("Error setting APQHandlers: " + t.toString());
- Cache.trace(Cache.getStackTraceString(t));
+ jalview.bin.Console.warn("Error setting APQHandlers: " + t.toString());
+ jalview.bin.Console.trace(Cache.getStackTraceString(t));
}
setIconImages(ChannelProperties.getIconList());
@@ -485,10 +495,10 @@ public class Desktop extends jalview.jbgui.GDesktop
new Thread(new Runnable() {
@Override
public void run() {
- Cache.log.debug("Filechooser init thread started.");
+ jalview.bin.Console.debug("Filechooser init thread started.");
String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
JalviewFileChooser.forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat);
- Cache.log.debug("Filechooser init thread finished.");
+ jalview.bin.Console.debug("Filechooser init thread finished.");
}
}).start();
// Add the service change listener
@@ -496,7 +506,7 @@ public class Desktop extends jalview.jbgui.GDesktop
@Override
public void propertyChange(PropertyChangeEvent evt) {
- Cache.log.debug("Firing service changed event for " + evt.getNewValue());
+ jalview.bin.Console.debug("Firing service changed event for " + evt.getNewValue());
JalviewServicesChanged(evt);
}
});
@@ -549,7 +559,8 @@ public class Desktop extends jalview.jbgui.GDesktop
if (Cache.getDefault(Preferences.ADD_SS_ANN, true)) {
ssm.setAddTempFacAnnot(Cache.getDefault(Preferences.ADD_TEMPFACT_ANN, true));
ssm.setProcessSecondaryStructure(Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
- ssm.setSecStructServices(Cache.getDefault(Preferences.USE_RNAVIEW, true));
+ // JAL-3915 - RNAView is no longer an option so this has no effect
+ ssm.setSecStructServices(Cache.getDefault(Preferences.USE_RNAVIEW, false));
} else {
ssm.setAddTempFacAnnot(false);
ssm.setProcessSecondaryStructure(false);
@@ -563,28 +574,36 @@ public class Desktop extends jalview.jbgui.GDesktop
new Thread(new Runnable() {
@Override
public void run() {
- Cache.log.debug("Starting news thread.");
+ jalview.bin.Console.debug("Starting news thread.");
jvnews = new BlogReader(me);
showNews.setVisible(true);
- Cache.log.debug("Completed news thread.");
+ jalview.bin.Console.debug("Completed news thread.");
}
}).start();
}
- public void getIdentifiersOrgData() {
- if (Cache.getProperty("NOIDENTIFIERSSERVICE") == null) {
- // Thread off the identifiers fetcher
- new Thread(new Runnable() {
+ public void getIdentifiersOrgData()
+ {
+ if (Cache.getProperty("NOIDENTIFIERSSERVICE") == null)
+ {// Thread off the identifiers fetcher
+ new Thread(new Runnable()
+ {
@Override
- public void run() {
- Cache.log.debug("Downloading data from identifiers.org");
- try {
- UrlDownloadClient.download(IdOrgSettings.getUrl(), IdOrgSettings.getDownloadLocation());
- } catch (IOException e) {
- Cache.log.debug("Exception downloading identifiers.org data" + e.getMessage());
+ public void run()
+ {
+ jalview.bin.Console.debug("Downloading data from identifiers.org");
+ try
+ {
+ UrlDownloadClient.download(IdOrgSettings.getUrl(),
+ IdOrgSettings.getDownloadLocation());
+ } catch (IOException e)
+ {
+ jalview.bin.Console.debug("Exception downloading identifiers.org data"
+ + e.getMessage());
}
}
}).start();
+ ;
}
}
@@ -594,7 +613,7 @@ public class Desktop extends jalview.jbgui.GDesktop
}
void showNews(boolean visible) {
- Cache.log.debug((visible ? "Showing" : "Hiding") + " news.");
+ jalview.bin.Console.debug((visible ? "Showing" : "Hiding") + " news.");
showNews.setSelected(visible);
if (visible && !jvnews.isVisible()) {
new Thread(new Runnable() {
@@ -640,14 +659,14 @@ public class Desktop extends jalview.jbgui.GDesktop
iy = (int) (iy * sh);
ih = (int) (ih * sh);
while (ix >= screenSize.width) {
- Cache.log.debug("Window geometry location recall error: shifting horizontal to within screenbounds.");
+ jalview.bin.Console.debug("Window geometry location recall error: shifting horizontal to within screenbounds.");
ix -= screenSize.width;
}
while (iy >= screenSize.height) {
- Cache.log.debug("Window geometry location recall error: shifting vertical to within screenbounds.");
+ jalview.bin.Console.debug("Window geometry location recall error: shifting vertical to within screenbounds.");
iy -= screenSize.height;
}
- Cache.log.debug("Got last known dimensions for " + windowName + ": x:" + ix + " y:" + iy + " width:" + iw
+ jalview.bin.Console.debug("Got last known dimensions for " + windowName + ": x:" + ix + " y:" + iy + " width:" + iw
+ " height:" + ih);
}
// return dimensions for new instance
@@ -849,7 +868,7 @@ public class Desktop extends jalview.jbgui.GDesktop
frame.requestFocus();
} catch (java.beans.PropertyVetoException ve) {
} catch (java.lang.ClassCastException cex) {
- Cache.log.warn(
+ jalview.bin.Console.warn(
"Squashed a possible GUI implementation error. If you can recreate this, please look at https://issues.jalview.org/browse/JAL-869",
cex);
}
@@ -1055,7 +1074,7 @@ public class Desktop extends jalview.jbgui.GDesktop
String url = (history instanceof JTextField ? ((JTextField) history).getText()
: ((JComboBox) history).getEditor().getItem().toString().trim());
- if (url.toLowerCase().endsWith(".jar")) {
+ if (url.toLowerCase(Locale.ROOT).endsWith(".jar")) {
if (viewport != null) {
new FileLoader().LoadFile(viewport, url, DataSourceType.URL, FileFormat.Jalview);
} else {
@@ -1137,7 +1156,7 @@ public class Desktop extends jalview.jbgui.GDesktop
}
private void storeLastKnownDimensions(String string, Rectangle jc) {
- Cache.log.debug("Storing last known dimensions for " + string + ": x:" + jc.x + " y:" + jc.y + " width:" + jc.width
+ jalview.bin.Console.debug("Storing last known dimensions for " + string + ": x:" + jc.x + " y:" + jc.y + " width:" + jc.width
+ " height:" + jc.height);
Cache.setProperty(string + "SCREEN_X", jc.x + "");
@@ -1181,7 +1200,7 @@ public class Desktop extends jalview.jbgui.GDesktop
// message.append("
...Checking latest version...");
} else if (!latestVersion.equals(Cache.getProperty("VERSION"))) {
boolean red = false;
- if (Cache.getProperty("VERSION").toLowerCase().indexOf("automated build") == -1) {
+ if (Cache.getProperty("VERSION").toLowerCase(Locale.ROOT).indexOf("automated build") == -1) {
red = true;
// Displayed when code version and jnlp version do not match and code
// version is not a development build
@@ -1272,9 +1291,9 @@ public class Desktop extends jalview.jbgui.GDesktop
@Override
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.");
}
/*
@@ -1438,7 +1457,7 @@ public class Desktop extends jalview.jbgui.GDesktop
} catch (OutOfMemoryError oom) {
new OOMWarning("Whilst saving current state to " + chosenFile.getName(), oom);
} catch (Exception ex) {
- Cache.log.error("Problems whilst trying to save to " + chosenFile.getName(), ex);
+ jalview.bin.Console.error("Problems whilst trying to save to " + chosenFile.getName(), ex);
JvOptionPane.showMessageDialog(me,
MessageManager.formatMessage("label.error_whilst_saving_current_state_to",
new Object[] { chosenFile.getName() }),
@@ -1493,7 +1512,7 @@ public class Desktop extends jalview.jbgui.GDesktop
} catch (OutOfMemoryError oom) {
new OOMWarning("Whilst loading project from " + choice, oom);
} catch (Exception ex) {
- Cache.log.error("Problems whilst loading project from " + choice, 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);
@@ -1980,7 +1999,7 @@ public class Desktop extends jalview.jbgui.GDesktop
try {
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"),
@@ -2291,7 +2310,7 @@ public class Desktop extends jalview.jbgui.GDesktop
});
}
} else {
- Cache.log.error("Errors reported by JABA discovery service. Check web services preferences.\n" + ermsg);
+ jalview.bin.Console.error("Errors reported by JABA discovery service. Check web services preferences.\n" + ermsg);
}
}
}
@@ -2362,11 +2381,7 @@ public class Desktop extends jalview.jbgui.GDesktop
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.");
- }
+ jalview.bin.Console.error("Couldn't handle string " + url + " as a URL.");
}
// ignore any exceptions due to dud links.
}
@@ -2412,7 +2427,7 @@ public class Desktop extends jalview.jbgui.GDesktop
try {
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);
}
}
});
@@ -2446,7 +2461,7 @@ public class Desktop extends jalview.jbgui.GDesktop
@Override
public void exportImage(Graphics g) throws Exception {
paintAll(g);
- Cache.log.info("Successfully written snapshot to file " + of.getAbsolutePath());
+ jalview.bin.Console.info("Successfully written snapshot to file " + of.getAbsolutePath());
}
};
String title = "View of desktop";
@@ -2605,7 +2620,7 @@ public class Desktop extends jalview.jbgui.GDesktop
try {
urlFlavour = new DataFlavor("application/x-java-url; class=java.net.URL");
} catch (ClassNotFoundException cfe) {
- Cache.log.debug("Couldn't instantiate the URL dataflavor.", cfe);
+ jalview.bin.Console.debug("Couldn't instantiate the URL dataflavor.", cfe);
}
if (urlFlavour != null && t.isDataFlavorSupported(urlFlavour)) {
@@ -2617,7 +2632,7 @@ public class Desktop extends jalview.jbgui.GDesktop
if (url != null) {
protocols.add(DataSourceType.URL);
files.add(url.toString());
- Cache.log.debug("Drop handled as URL dataflavor " + files.get(files.size() - 1));
+ jalview.bin.Console.debug("Drop handled as URL dataflavor " + files.get(files.size() - 1));
return;
} else {
if (Platform.isAMacAndNotJS()) {
@@ -2625,12 +2640,12 @@ public class Desktop extends jalview.jbgui.GDesktop
}
}
} catch (Throwable ex) {
- Cache.log.debug("URL drop handler failed.", ex);
+ jalview.bin.Console.debug("URL drop handler failed.", ex);
}
}
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
// Works on Windows and MacOSX
- Cache.log.debug("Drop handled as javaFileListFlavor");
+ jalview.bin.Console.debug("Drop handled as javaFileListFlavor");
for (Object file : (List) t.getTransferData(DataFlavor.javaFileListFlavor)) {
files.add(file);
protocols.add(DataSourceType.FILE);
@@ -2640,25 +2655,25 @@ public class Desktop extends jalview.jbgui.GDesktop
boolean added = false;
String data = null;
if (t.isDataFlavorSupported(uriListFlavor)) {
- Cache.log.debug("Drop handled as uriListFlavor");
+ jalview.bin.Console.debug("Drop handled as uriListFlavor");
// This is used by Unix drag system
data = (String) t.getTransferData(uriListFlavor);
}
if (data == null) {
// fallback to text: workaround - on OSX where there's a JVM bug
- Cache.log.debug("standard URIListFlavor failed. Trying text");
+ jalview.bin.Console.debug("standard URIListFlavor failed. Trying text");
// try text fallback
DataFlavor textDf = new DataFlavor("text/plain;class=java.lang.String");
if (t.isDataFlavorSupported(textDf)) {
data = (String) t.getTransferData(textDf);
}
- Cache.log.debug("Plain text drop content returned " + (data == null ? "Null - failed" : data));
+ jalview.bin.Console.debug("Plain text drop content returned " + (data == null ? "Null - failed" : data));
}
if (data != null) {
while (protocols.size() < files.size()) {
- Cache.log.debug("Adding missing FILE protocol for " + files.get(protocols.size()));
+ jalview.bin.Console.debug("Adding missing FILE protocol for " + files.get(protocols.size()));
protocols.add(DataSourceType.FILE);
}
for (java.util.StringTokenizer st = new java.util.StringTokenizer(data, "\r\n"); st.hasMoreTokens();) {
@@ -2669,7 +2684,7 @@ public class Desktop extends jalview.jbgui.GDesktop
continue;
}
java.net.URI uri = new java.net.URI(s);
- if (uri.getScheme().toLowerCase().startsWith("http")) {
+ if (uri.getScheme().toLowerCase(Locale.ROOT).startsWith("http")) {
protocols.add(DataSourceType.URL);
files.add(uri.toString());
} else {
@@ -2681,46 +2696,46 @@ public class Desktop extends jalview.jbgui.GDesktop
}
}
- if (Cache.log.isDebugEnabled()) {
+ if (jalview.bin.Console.isDebugEnabled()) {
if (data == null || !added) {
if (t.getTransferDataFlavors() != null && t.getTransferDataFlavors().length > 0) {
- Cache.log.debug("Couldn't resolve drop data. Here are the supported flavors:");
+ jalview.bin.Console.debug("Couldn't resolve drop data. Here are the supported flavors:");
for (DataFlavor fl : t.getTransferDataFlavors()) {
- Cache.log.debug("Supported transfer dataflavor: " + fl.toString());
+ jalview.bin.Console.debug("Supported transfer dataflavor: " + fl.toString());
Object df = t.getTransferData(fl);
if (df != null) {
- Cache.log.debug("Retrieves: " + df);
+ jalview.bin.Console.debug("Retrieves: " + df);
} else {
- Cache.log.debug("Retrieved nothing");
+ jalview.bin.Console.debug("Retrieved nothing");
}
}
} else {
- Cache.log.debug("Couldn't resolve dataflavor for drop: " + t.toString());
+ jalview.bin.Console.debug("Couldn't resolve dataflavor for drop: " + t.toString());
}
}
}
}
if (Platform.isWindowsAndNotJS()) {
- Cache.log.debug("Scanning dropped content for Windows Link Files");
+ jalview.bin.Console.debug("Scanning dropped content for Windows Link Files");
// resolve any .lnk files in the file drop
for (int f = 0; f < files.size(); f++) {
- String source = files.get(f).toString().toLowerCase();
+ String source = files.get(f).toString().toLowerCase(Locale.ROOT);
if (protocols.get(f).equals(DataSourceType.FILE)
&& (source.endsWith(".lnk") || source.endsWith(".url") || source.endsWith(".site"))) {
try {
Object obj = files.get(f);
File lf = (obj instanceof File ? (File) obj : new File((String) obj));
// process link file to get a URL
- Cache.log.debug("Found potential link file: " + lf);
+ jalview.bin.Console.debug("Found potential link file: " + lf);
WindowsShortcut wscfile = new WindowsShortcut(lf);
String fullname = wscfile.getRealFilename();
protocols.set(f, FormatAdapter.checkProtocol(fullname));
files.set(f, fullname);
- Cache.log.debug("Parsed real filename " + fullname + " to extract protocol: " + protocols.get(f));
+ jalview.bin.Console.debug("Parsed real filename " + fullname + " to extract protocol: " + protocols.get(f));
} catch (Exception ex) {
- Cache.log.error("Couldn't parse " + files.get(f) + " as a link file.", ex);
+ jalview.bin.Console.error("Couldn't parse " + files.get(f) + " as a link file.", ex);
}
}
}
@@ -2779,14 +2794,14 @@ public class Desktop extends jalview.jbgui.GDesktop
AffineTransform t = gg.getTransform();
double scaleX = t.getScaleX();
double scaleY = t.getScaleY();
- Cache.debug(debugScaleMessage + scaleX + " (X)");
- Cache.debug(debugScaleMessage + scaleY + " (Y)");
+ jalview.bin.Console.debug(debugScaleMessage + scaleX + " (X)");
+ jalview.bin.Console.debug(debugScaleMessage + scaleY + " (Y)");
debugScaleMessageDone = true;
} else {
- Cache.debug("Desktop graphics null");
+ jalview.bin.Console.debug("Desktop graphics null");
}
} catch (Exception e) {
- Cache.debug(Cache.getStackTraceString(e));
+ jalview.bin.Console.debug(Cache.getStackTraceString(e));
}
}
}