").append("
Version: ")
+ .append(Cache.getProperty("VERSION")).append("
").append("
Built: ")
+ .append(Cache.getDefault("BUILD_DATE", "unknown")).append(" from ")
+ .append(Cache.getBuildDetailsForSplash()).append("");
String latestVersion = Cache.getDefault("LATEST_VERSION", "Checking");
- if (latestVersion.equals("Checking"))
- {
+ if (latestVersion.equals("Checking")) {
// JBP removed this message for 2.11: May be reinstated in future version
// message.append("
...Checking latest version...");
- }
- else if (!latestVersion.equals(Cache.getProperty("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
message.append("
");
}
- message.append("
!! Version ")
- .append(Cache.getDefault("LATEST_VERSION", "..Checking.."))
- .append(" is available for download from ")
- .append(Cache.getDefault("www.jalview.org",
- "http://www.jalview.org"))
- .append(" !!");
- if (red)
- {
+ message.append("
!! Version ").append(Cache.getDefault("LATEST_VERSION", "..Checking.."))
+ .append(" is available for download from ")
+ .append(Cache.getDefault("www.jalview.org", "https://www.jalview.org")).append(" !!");
+ if (red) {
message.append("
");
}
}
@@ -1403,6 +1201,8 @@ public class Desktop extends jalview.jbgui.GDesktop
message.append(Cache.getDefault("AUTHORFNAMES", DEFAULT_AUTHORS));
message.append(CITATION);
+ message.append("
");
+
return message.toString();
}
@@ -1410,15 +1210,11 @@ public class Desktop extends jalview.jbgui.GDesktop
* Action on requesting Help documentation
*/
@Override
- public void documentationMenuItem_actionPerformed()
- {
- try
- {
- if (Platform.isJS())
- {
- BrowserLauncher.openURL("http://www.jalview.org/help.html");
- }
- else
+ public void documentationMenuItem_actionPerformed() {
+ try {
+ if (Platform.isJS()) {
+ BrowserLauncher.openURL("https://www.jalview.org/help.html");
+ } else
/**
* Java only
*
@@ -1427,24 +1223,19 @@ public class Desktop extends jalview.jbgui.GDesktop
{
Help.showHelpWindow();
}
- } catch (Exception ex)
- {
+ } catch (Exception ex) {
System.err.println("Error opening help: " + ex.getMessage());
}
}
@Override
- public void closeAll_actionPerformed(ActionEvent e)
- {
+ public void closeAll_actionPerformed(ActionEvent e) {
// TODO show a progress bar while closing?
JInternalFrame[] frames = desktop.getAllFrames();
- for (int i = 0; i < frames.length; i++)
- {
- try
- {
+ for (int i = 0; i < frames.length; i++) {
+ try {
frames[i].setClosed(true);
- } catch (java.beans.PropertyVetoException ex)
- {
+ } catch (java.beans.PropertyVetoException ex) {
}
}
Jalview.setCurrentAlignFrame(null);
@@ -1454,28 +1245,23 @@ public class Desktop extends jalview.jbgui.GDesktop
* reset state of singleton objects as appropriate (clear down session state
* when all windows are closed)
*/
- StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(this);
- if (ssm != null)
- {
+ StructureSelectionManager ssm = StructureSelectionManager.getStructureSelectionManager(this);
+ if (ssm != null) {
ssm.resetAll();
}
}
@Override
- public void raiseRelated_actionPerformed(ActionEvent e)
- {
+ public void raiseRelated_actionPerformed(ActionEvent e) {
reorderAssociatedWindows(false, false);
}
@Override
- public void minimizeAssociated_actionPerformed(ActionEvent e)
- {
+ public void minimizeAssociated_actionPerformed(ActionEvent e) {
reorderAssociatedWindows(true, false);
}
- void closeAssociatedWindows()
- {
+ void closeAssociatedWindows() {
reorderAssociatedWindows(false, true);
}
@@ -1486,8 +1272,7 @@ public class Desktop extends jalview.jbgui.GDesktop
* ActionEvent)
*/
@Override
- protected void garbageCollect_actionPerformed(ActionEvent e)
- {
+ protected void garbageCollect_actionPerformed(ActionEvent e) {
// We simply collect the garbage
Cache.log.debug("Collecting garbage...");
System.gc();
@@ -1497,13 +1282,11 @@ public class Desktop extends jalview.jbgui.GDesktop
/*
* (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)
- {
+ protected void showMemusage_actionPerformed(ActionEvent e) {
desktop.showMemoryUsage(showMemusage.isSelected());
}
@@ -1515,8 +1298,7 @@ public class Desktop extends jalview.jbgui.GDesktop
* )
*/
@Override
- protected void showConsole_actionPerformed(ActionEvent e)
- {
+ protected void showConsole_actionPerformed(ActionEvent e) {
showConsole(showConsole.isSelected());
}
@@ -1527,89 +1309,61 @@ public class Desktop extends jalview.jbgui.GDesktop
*
* @param selected
*/
- void showConsole(boolean selected)
- {
+ void showConsole(boolean selected) {
// TODO: decide if we should update properties file
if (jconsole != null) // BH 2018
{
showConsole.setSelected(selected);
- Cache.setProperty("SHOW_JAVA_CONSOLE",
- Boolean.valueOf(selected).toString());
+ Cache.setProperty("SHOW_JAVA_CONSOLE", Boolean.valueOf(selected).toString());
jconsole.setVisible(selected);
}
}
- void reorderAssociatedWindows(boolean minimize, boolean close)
- {
+ void reorderAssociatedWindows(boolean minimize, boolean close) {
JInternalFrame[] frames = desktop.getAllFrames();
- if (frames == null || frames.length < 1)
- {
+ if (frames == null || frames.length < 1) {
return;
}
AlignmentViewport source = null, target = null;
- if (frames[0] instanceof AlignFrame)
- {
+ if (frames[0] instanceof AlignFrame) {
source = ((AlignFrame) frames[0]).getCurrentView();
- }
- else if (frames[0] instanceof TreePanel)
- {
+ } else if (frames[0] instanceof TreePanel) {
source = ((TreePanel) frames[0]).getViewPort();
- }
- else if (frames[0] instanceof PCAPanel)
- {
+ } else if (frames[0] instanceof PCAPanel) {
source = ((PCAPanel) frames[0]).av;
- }
- else if (frames[0].getContentPane() instanceof PairwiseAlignPanel)
- {
+ } else if (frames[0].getContentPane() instanceof PairwiseAlignPanel) {
source = ((PairwiseAlignPanel) frames[0].getContentPane()).av;
}
- if (source != null)
- {
- for (int i = 0; i < frames.length; i++)
- {
+ if (source != null) {
+ for (int i = 0; i < frames.length; i++) {
target = null;
- if (frames[i] == null)
- {
+ if (frames[i] == null) {
continue;
}
- if (frames[i] instanceof AlignFrame)
- {
+ if (frames[i] instanceof AlignFrame) {
target = ((AlignFrame) frames[i]).getCurrentView();
- }
- else if (frames[i] instanceof TreePanel)
- {
+ } else if (frames[i] instanceof TreePanel) {
target = ((TreePanel) frames[i]).getViewPort();
- }
- else if (frames[i] instanceof PCAPanel)
- {
+ } else if (frames[i] instanceof PCAPanel) {
target = ((PCAPanel) frames[i]).av;
- }
- else if (frames[i].getContentPane() instanceof PairwiseAlignPanel)
- {
+ } else if (frames[i].getContentPane() instanceof PairwiseAlignPanel) {
target = ((PairwiseAlignPanel) frames[i].getContentPane()).av;
}
- if (source == target)
- {
- try
- {
- if (close)
- {
+ if (source == target) {
+ try {
+ if (close) {
frames[i].setClosed(true);
- }
- else
- {
+ } else {
frames[i].setIcon(minimize);
- if (!minimize)
- {
+ if (!minimize) {
frames[i].toFront();
}
}
- } catch (java.beans.PropertyVetoException ex)
- {
+ } catch (java.beans.PropertyVetoException ex) {
}
}
}
@@ -1619,13 +1373,11 @@ public class Desktop extends jalview.jbgui.GDesktop
/**
* DOCUMENT ME!
*
- * @param e
- * DOCUMENT ME!
+ * @param e DOCUMENT ME!
*/
@Override
- protected void preferences_actionPerformed(ActionEvent e)
- {
- new Preferences();
+ protected void preferences_actionPerformed(ActionEvent e) {
+ Preferences.openPreferences();
}
/**
@@ -1633,105 +1385,83 @@ public class Desktop extends jalview.jbgui.GDesktop
* Jalview project file
*/
@Override
- public void saveState_actionPerformed()
- {
+ public void saveState_actionPerformed() {
saveState_actionPerformed(false);
}
- public void saveState_actionPerformed(boolean saveAs)
- {
+ public void saveState_actionPerformed(boolean saveAs) {
java.io.File projectFile = getProjectFile();
// autoSave indicates we already have a file and don't need to ask
- boolean autoSave = projectFile != null && !saveAs
- && BackupFiles.getEnabled();
+ boolean autoSave = projectFile != null && !saveAs && BackupFiles.getEnabled();
// System.out.println("autoSave="+autoSave+", projectFile='"+projectFile+"',
// saveAs="+saveAs+", Backups
// "+(BackupFiles.getEnabled()?"enabled":"disabled"));
boolean approveSave = false;
- if (!autoSave)
- {
- JalviewFileChooser chooser = new JalviewFileChooser("jvp",
- "Jalview Project");
+ if (!autoSave) {
+ JalviewFileChooser chooser = new JalviewFileChooser("jvp", "Jalview Project");
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager.getString("label.save_state"));
int value = chooser.showSaveDialog(this);
- if (value == JalviewFileChooser.APPROVE_OPTION)
- {
+ if (value == JalviewFileChooser.APPROVE_OPTION) {
projectFile = chooser.getSelectedFile();
setProjectFile(projectFile);
approveSave = true;
}
}
- if (approveSave || autoSave)
- {
+ if (approveSave || autoSave) {
final Desktop me = this;
final java.io.File chosenFile = projectFile;
- new Thread(new Runnable()
- {
+ new Thread(new Runnable() {
@Override
- public void run()
- {
+ public void run() {
// TODO: refactor to Jalview desktop session controller action.
- setProgressBar(MessageManager.formatMessage(
- "label.saving_jalview_project", new Object[]
- { chosenFile.getName() }), chosenFile.hashCode());
- Cache.setProperty("LAST_DIRECTORY",
- chosenFile.getParent());
+ setProgressBar(
+ MessageManager.formatMessage("label.saving_jalview_project", new Object[] { chosenFile.getName() }),
+ chosenFile.hashCode());
+ 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();
+ try {
+ boolean doBackup = BackupFiles.getEnabled();
BackupFiles backupfiles = doBackup ? new BackupFiles(chosenFile) : null;
new Jalview2XML().saveState(doBackup ? backupfiles.getTempFile() : chosenFile);
- if (doBackup)
- {
+ if (doBackup) {
backupfiles.setWriteSuccess(true);
backupfiles.rollBackupsAndRenameTempFile();
}
- } 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);
+ } 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);
JvOptionPane.showMessageDialog(me,
- MessageManager.formatMessage(
- "label.error_whilst_saving_current_state_to",
- new Object[]
- { chosenFile.getName() }),
- MessageManager.getString("label.couldnt_save_project"),
- JvOptionPane.WARNING_MESSAGE);
+ MessageManager.formatMessage("label.error_whilst_saving_current_state_to",
+ new Object[] { chosenFile.getName() }),
+ MessageManager.getString("label.couldnt_save_project"), JvOptionPane.WARNING_MESSAGE);
}
setProgressBar(null, chosenFile.hashCode());
}
}).start();
- }
+ }
}
@Override
- public void saveAsState_actionPerformed(ActionEvent e)
- {
+ public void saveAsState_actionPerformed(ActionEvent e) {
saveState_actionPerformed(true);
}
- private void setProjectFile(File choice)
- {
+ private void setProjectFile(File choice) {
this.projectFile = choice;
}
- public File getProjectFile()
- {
+ public File getProjectFile() {
return this.projectFile;
}
@@ -1740,60 +1470,46 @@ public class Desktop extends jalview.jbgui.GDesktop
* Jalview project
*/
@Override
- public void loadState_actionPerformed()
- {
+ public void loadState_actionPerformed() {
final String[] suffix = new String[] { "jvp", "jar" };
- final String[] desc = new String[] { "Jalview Project",
- "Jalview Project (old)" };
- JalviewFileChooser chooser = new JalviewFileChooser(
- Cache.getProperty("LAST_DIRECTORY"), suffix, desc,
- "Jalview Project", true, BackupFiles.getEnabled()); // last two booleans: allFiles,
- // allowBackupFiles
+ final String[] desc = new String[] { "Jalview Project", "Jalview Project (old)" };
+ JalviewFileChooser chooser = new JalviewFileChooser(Cache.getProperty("LAST_DIRECTORY"), suffix, desc,
+ "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()
- {
+ chooser.setResponseHandler(0, new Runnable() {
@Override
- public void run()
- {
+ public void run() {
File selectedFile = chooser.getSelectedFile();
setProjectFile(selectedFile);
String choice = selectedFile.getAbsolutePath();
Cache.setProperty("LAST_DIRECTORY", selectedFile.getParent());
- new Thread(new Runnable()
- {
+ new Thread(new Runnable() {
@Override
- public void run()
- {
- try
- {
- new Jalview2XML().loadJalviewAlign(choice);
- } 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);
- }
+ public void run() {
+ try {
+ 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);
+ }
}
- }).start();
+ }, "Project Loader").start();
}
});
-
+
chooser.showOpenDialog(this);
}
@Override
- public void inputSequence_actionPerformed(ActionEvent e)
- {
+ public void inputSequence_actionPerformed(ActionEvent e) {
new SequenceFetcher(this);
}
@@ -1801,21 +1517,16 @@ public class Desktop extends jalview.jbgui.GDesktop
ArrayList