/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
+ * Copyright (C) 2014 The Jalview Authors
*
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
+ *
* Jalview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
*/
package jalview.gui;
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
+import jalview.util.MessageManager;
import jalview.ws.params.ParamManager;
import java.awt.BorderLayout;
import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Hashtable;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
-import javax.swing.JTextArea;
import javax.swing.SwingUtilities;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.MenuEvent;
void showPasteMenu(int x, int y)
{
JPopupMenu popup = new JPopupMenu();
- JMenuItem item = new JMenuItem("Paste To New Window");
+ JMenuItem item = new JMenuItem(MessageManager.getString("label.paste_new_window"));
item.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
// A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
// IF JALVIEW IS RUNNING HEADLESS
// ///////////////////////////////////////////////
- if (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true"))
+ if (instance == null || (System.getProperty("java.awt.headless") != null
+ && System.getProperty("java.awt.headless").equals("true")))
{
return;
}
*/
public void drop(DropTargetDropEvent evt)
{
+ boolean success=true;
Transferable t = evt.getTransferable();
java.util.List files = null;
java.util.List protocols = null;
}
} catch (Exception e)
{
+ success=false;
}
if (files != null)
}
} catch (Exception ex)
{
+ success=false;
}
}
+ evt.dropComplete(success); // need this to ensure input focus is properly transfered to any new windows created
}
/**
jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle("Open local file");
- chooser.setToolTipText("Open");
+ chooser.setDialogTitle(MessageManager.getString("label.open_local_file"));
+ chooser.setToolTipText(MessageManager.getString("action.open"));
int value = chooser.showOpenDialog(this);
.getSelectedFile().getParent());
String format = null;
- if (chooser.getSelectedFormat().equals("Jalview"))
+ if (chooser.getSelectedFormat()!=null && chooser.getSelectedFormat().equals("Jalview"))
{
format = "Jalview";
}
{
// This construct allows us to have a wider textfield
// for viewing
- JLabel label = new JLabel("Enter URL of Input File");
+ JLabel label = new JLabel(MessageManager.getString("label.input_file_url"));
final JComboBox history = new JComboBox();
JPanel panel = new JPanel(new GridLayout(2, 1));
}
int reply = JOptionPane.showInternalConfirmDialog(desktop, panel,
- "Input Alignment From URL", JOptionPane.OK_CANCEL_OPTION);
+ MessageManager.getString("label.input_alignment_from_url"), JOptionPane.OK_CANCEL_OPTION);
if (reply != JOptionPane.OK_OPTION)
{
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle("Open a saved VAMSAS session");
- chooser.setToolTipText("select a vamsas session to be opened as a new vamsas session.");
+ chooser.setToolTipText(MessageManager.getString("label.select_vamsas_session_opened_as_new_vamsas_session"));
int value = chooser.showOpenDialog(this);
if (!vamsasImport(chooser.getSelectedFile()))
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
- "Couldn't import '" + fle + "' as a new vamsas session.",
- "Vamsas Document Import Failed",
+ MessageManager.formatMessage("label.couldnt_import_as_vamsas_session", new String[]{fle}),
+ MessageManager.getString("label.vamsas_document_import_failed"),
JOptionPane.ERROR_MESSAGE);
}
}
protected void setupVamsasConnectedGui()
{
- vamsasStart.setText("Session Update");
+ vamsasStart.setText(MessageManager.getString("label.session_update"));
vamsasSave.setVisible(true);
vamsasStop.setVisible(true);
vamsasImport.setVisible(false); // Document import to existing session is
vamsasSave.setVisible(false);
vamsasStop.setVisible(false);
vamsasImport.setVisible(true);
- vamsasStart.setText("New Vamsas Session");
+ vamsasStart.setText(MessageManager.getString("label.new_vamsas_session"));
}
public void vamsasStop_actionPerformed(ActionEvent e)
{
JMenuItem sessit = new JMenuItem();
sessit.setText(sess[i]);
- sessit.setToolTipText("Connect to session " + sess[i]);
+ sessit.setToolTipText(MessageManager.formatMessage("label.connect_to_session", new String[]{sess[i]}));
final Desktop dsktp = this;
final String mysesid = sess[i];
sessit.addActionListener(new ActionListener()
if (fm != null)
{
g.drawString(
- "Total Free Memory: " + df.format(totalFreeMemory)
- + "MB; Max Memory: " + df.format(maxMemory)
- + "MB; " + df.format(percentUsage) + "%", 10,
+ MessageManager.formatMessage("label.memory_stats", new String[]{df.format(totalFreeMemory),df.format(maxMemory),df.format(percentUsage)}), 10,
getHeight() - fm.getHeight());
}
}
if (jalview.bin.Cache.groovyJarsPresent())
{
groovyShell = new JMenuItem();
- groovyShell.setText("Groovy Console...");
+ groovyShell.setText(MessageManager.getString("label.groovy_console"));
groovyShell.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
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()
{
{
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)
{
}
// JAL-940 - disabled JWS1 service configuration - always start discoverer
// until we phase out completely
- if (true)
- {
(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
+ {
+ 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)
{
- // 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();
+ 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())
{
/*
- 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("<html><table width=\"450\"><tr><td>"
- + ermsg
- + "<br/>It may be that you have invalid JABA URLs in your web service preferences,"
- + " or mis-configured HTTP proxy settings.<br/>"
- + "Check the <em>Connections</em> and <em>Web services</em> tab of the"
- + " Tools->Preferences dialog box to change them.</td></tr></table></html>"), true, true, "Web Service Configuration Problem", 450, 400);
-
- jd.waitForInput();
- */
- JOptionPane.showConfirmDialog(
- Desktop.desktop,
- new JLabel("<html><table width=\"450\"><tr><td>"
- + ermsg+"</td></tr></table>"
- + "<p>It may be that you have invalid JABA URLs<br/>in your web service preferences,"
- + " or mis-configured HTTP proxy settings.</p>"
- + "<p>Check the <em>Connections</em> and <em>Web services</em> tab<br/>of the"
- + " Tools->Preferences dialog box to change them.</p></html>"), "Web Service Configuration Problem",
+ * 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("<html><table width=\"450\"><tr><td>" + ermsg +
+ * "<br/>It may be that you have invalid JABA URLs in your web service preferences,"
+ * + " or mis-configured HTTP proxy settings.<br/>" +
+ * "Check the <em>Connections</em> and <em>Web services</em> tab of the"
+ * +
+ * " Tools->Preferences dialog box to change them.</td></tr></table></html>"
+ * ), true, true, "Web Service Configuration Problem", 450,
+ * 400);
+ *
+ * jd.waitForInput();
+ */
+ JOptionPane
+ .showConfirmDialog(
+ Desktop.desktop,
+ new JLabel(
+ "<html><table width=\"450\"><tr><td>"
+ + ermsg
+ + "</td></tr></table>"
+ + "<p>It may be that you have invalid JABA URLs<br/>in your web service preferences,"
+ + " or mis-configured HTTP proxy settings.</p>"
+ + "<p>Check the <em>Connections</em> and <em>Web services</em> tab<br/>of the"
+ + " Tools->Preferences dialog box to change them.</p></html>"),
+ "Web Service Configuration Problem",
JOptionPane.DEFAULT_OPTION,
- JOptionPane.ERROR_MESSAGE);
+ JOptionPane.ERROR_MESSAGE);
serviceChangedDialog = null;
}