X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=3f3950c20ed9b5b49ad710aa580c493418f7e20a;hb=ad15cff29620f960119f80176f1fd443da9f6763;hp=b7057d17e11216a8b99c9bfe1f556f561a4e18dc;hpb=d8ddf2968124b3518e567a91411357b1d291ff77;p=jalview.git
diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java
index b7057d1..3f3950c 100644
--- a/src/jalview/gui/Desktop.java
+++ b/src/jalview/gui/Desktop.java
@@ -1,6 +1,6 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
@@ -26,6 +26,8 @@ import jalview.io.FormatAdapter;
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
+import jalview.jbgui.GStructureViewer;
+import jalview.structure.StructureSelectionManager;
import jalview.util.ImageMaker;
import jalview.util.MessageManager;
import jalview.ws.params.ParamManager;
@@ -89,9 +91,9 @@ import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
-import javax.swing.event.HyperlinkEvent.EventType;
/**
* Jalview Desktop
@@ -112,6 +114,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
*/
private BlogReader jvnews = null;
+ private File projectFile;
+
/**
* @param listener
* @see jalview.gui.JalviewChangeSupport#addJalviewPropertyChangeListener(java.beans.PropertyChangeListener)
@@ -286,7 +290,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
instance = this;
doVamsasClientCheck();
doGroovyCheck();
-
+ doConfigureStructurePrefs();
setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
@@ -317,13 +321,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
else
{
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- setBounds((int) (screenSize.width - 900) / 2,
- (int) (screenSize.height - 650) / 2, 900, 650);
+ setBounds((screenSize.width - 900) / 2,
+ (screenSize.height - 650) / 2, 900, 650);
}
jconsole = new Console(this, showjconsole);
// add essential build information
- jconsole.setHeader("Jalview Desktop "
+ jconsole.setHeader("Jalview Version: "
+ jalview.bin.Cache.getProperty("VERSION") + "\n"
+ + "Jalview Installation: "
+ + jalview.bin.Cache.getDefault("INSTALLATION", "unknown")
+ + "\n"
+ "Build Date: "
+ jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n"
+ "Java version: " + System.getProperty("java.version") + "\n"
@@ -416,6 +423,27 @@ public class Desktop extends jalview.jbgui.GDesktop implements
});
}
+ public void doConfigureStructurePrefs()
+ {
+ // configure services
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(this);
+ if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true))
+ {
+ ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault(
+ Preferences.ADD_TEMPFACT_ANN, true));
+ ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
+ ssm.setSecStructServices(jalview.bin.Cache.getDefault(Preferences.USE_RNAVIEW,
+ true));
+ }
+ else
+ {
+ ssm.setAddTempFacAnnot(false);
+ ssm.setProcessSecondaryStructure(false);
+ ssm.setSecStructServices(false);
+ }
+ }
+
public void checkForNews()
{
final Desktop me = this;
@@ -452,7 +480,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
public void run()
{
long instance = System.currentTimeMillis();
- Desktop.instance.setProgressBar("Refreshing news", instance);
+ Desktop.instance.setProgressBar(MessageManager.getString("status.refreshing_news"), instance);
jvnews.refreshNews();
Desktop.instance.setProgressBar(null, instance);
jvnews.showNews();
@@ -606,38 +634,85 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* Adds and opens the given frame to the desktop
*
* @param frame
- * DOCUMENT ME!
+ * Frame to show
* @param title
- * DOCUMENT ME!
+ * Visible Title
* @param w
- * DOCUMENT ME!
+ * width
* @param h
- * DOCUMENT ME!
+ * height
*/
public static synchronized void addInternalFrame(
final JInternalFrame frame, String title, int w, int h)
{
- addInternalFrame(frame, title, w, h, true);
+ addInternalFrame(frame, title, true, w, h, true);
}
+
/**
- * DOCUMENT ME!
+ * Add an internal frame to the Jalview desktop
*
* @param frame
- * DOCUMENT ME!
+ * Frame to show
* @param title
- * DOCUMENT ME!
+ * Visible Title
+ * @param makeVisible
+ * When true, display frame immediately, otherwise, caller must call
+ * setVisible themselves.
* @param w
- * DOCUMENT ME!
+ * width
* @param h
- * DOCUMENT ME!
+ * height
+ */
+ public static synchronized void addInternalFrame(
+ final JInternalFrame frame, String title, boolean makeVisible,
+ int w, int h)
+ {
+ addInternalFrame(frame, title, makeVisible, w, h, true);
+ }
+
+ /**
+ * Add an internal frame to the Jalview desktop and make it visible
+ *
+ * @param frame
+ * Frame to show
+ * @param title
+ * Visible Title
+ * @param w
+ * width
+ * @param h
+ * height
* @param resizable
- * DOCUMENT ME!
+ * Allow resize
*/
public static synchronized void addInternalFrame(
final JInternalFrame frame, String title, int w, int h,
boolean resizable)
{
+ addInternalFrame(frame, title, true, w, h, resizable);
+ }
+
+ /**
+ * Add an internal frame to the Jalview desktop
+ *
+ * @param frame
+ * Frame to show
+ * @param title
+ * Visible Title
+ * @param makeVisible
+ * When true, display frame immediately, otherwise, caller must call
+ * setVisible themselves.
+ * @param w
+ * width
+ * @param h
+ * height
+ * @param resizable
+ * Allow resize
+ */
+ public static synchronized void addInternalFrame(
+ final JInternalFrame frame, String title, boolean makeVisible,
+ int w, int h, boolean resizable)
+ {
// TODO: allow callers to determine X and Y position of frame (eg. via
// bounds object).
@@ -662,7 +737,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
openFrameCount++;
- frame.setVisible(true);
+ frame.setVisible(makeVisible);
frame.setClosable(true);
frame.setResizable(resizable);
frame.setMaximizable(resizable);
@@ -1012,7 +1087,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
if (format.equals("URL NOT FOUND"))
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Couldn't locate " + url, "URL not found",
+ MessageManager.formatMessage("label.couldnt_locate", new String[]{url}), MessageManager.getString("label.url_not_found"),
JOptionPane.WARNING_MESSAGE);
return;
@@ -1039,7 +1114,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
cap.setForInput(viewport);
- Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500);
+ Desktop.addInternalFrame(cap,
+ MessageManager.getString("label.cut_paste_alignmen_file"),
+ true, 600, 500);
}
/*
@@ -1183,13 +1260,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
try
{
- ClassLoader cl = jalview.gui.Desktop.class.getClassLoader();
- java.net.URL url = javax.help.HelpSet.findHelpSet(cl, "help/help");
- javax.help.HelpSet hs = new javax.help.HelpSet(cl, url);
-
- javax.help.HelpBroker hb = hs.createHelpBroker();
- hb.setCurrentID("home");
- hb.setDisplayed(true);
+ Help.showHelpWindow();
} catch (Exception ex)
{
}
@@ -1386,7 +1457,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{ "Jalview Project" }, "Jalview Project");
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Save State");
+ chooser.setDialogTitle(MessageManager.getString("label.save_state"));
int value = chooser.showSaveDialog(this);
@@ -1394,12 +1465,17 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
final Desktop me = this;
final java.io.File choice = chooser.getSelectedFile();
+ setProjectFile(choice);
+
+ // TODO or move inside the new Thread?
+ saveChimeraSessions(choice.getAbsolutePath());
+
new Thread(new Runnable()
{
public void run()
{
- setProgressBar("Saving jalview project " + choice.getName(),
+ setProgressBar(MessageManager.formatMessage("label.saving_jalview_project", new String[]{choice.getName()}),
choice.hashCode());
jalview.bin.Cache.setProperty("LAST_DIRECTORY",
choice.getParent());
@@ -1407,7 +1483,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
// TODO prevent user from messing with the Desktop whilst we're saving
try
{
- new Jalview2XML().SaveState(choice);
+ new Jalview2XML().saveState(choice);
} catch (OutOfMemoryError oom)
{
new OOMWarning("Whilst saving current state to "
@@ -1419,8 +1495,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
ex);
JOptionPane.showMessageDialog(
me,
- "Error whilst saving current state to "
- + choice.getName(), "Couldn't save project",
+ MessageManager.formatMessage("label.error_whilst_saving_current_state_to", new String[]{ choice.getName()}),
+ MessageManager.getString("label.couldnt_save_project"),
JOptionPane.WARNING_MESSAGE);
}
setProgressBar(null, choice.hashCode());
@@ -1430,6 +1506,42 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
/**
+ * Request any open, linked Chimera sessions to save their state.
+ *
+ * @param jalviewProjectFilename
+ * the filename of the Jalview project; Chimera session files should
+ * be given distinct, but obviously related, names.
+ */
+ public void saveChimeraSessions(String jalviewProjectFilename)
+ {
+ int i = 0;
+ for (JInternalFrame frame : getAllFrames())
+ {
+ if (frame instanceof ChimeraViewFrame)
+ {
+ /*
+ * Construct a filename for the Chimera session by append _chimera It may be that you have invalid JABA URLs
in your web service preferences,"
- + " or mis-configured HTTP proxy settings.
or as a command-line argument, or mis-configured HTTP proxy settings.
Check the Connections and Web services tab
of the"
+ " Tools->Preferences dialog box to change them.