/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
* Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
import jalview.bin.Cache;
import jalview.io.*;
+import jalview.ws.params.ParamManager;
import java.awt.*;
import java.awt.datatransfer.*;
private class JalviewChangeSupport implements PropertyChangeListener
{
- @Override
public void propertyChange(PropertyChangeEvent evt)
{
// Handle change events - most are simply routed to other sources
iw = (int) (iw * sw);
iy = (int) (iy * sh);
ih = (int) (ih * sh);
+ while (ix>=screenSize.width) {
+ jalview.bin.Cache.log.debug("Window geometry location recall error: shifting horizontal to within screenbounds.");
+ ix-=screenSize.width;
+ }
+ while (iy>=screenSize.height) {
+ jalview.bin.Cache.log.debug("Window geometry location recall error: shifting vertical to within screenbounds.");
+ iy-=screenSize.height;
+ }
jalview.bin.Cache.log.debug("Got last known dimensions for "
+ windowName + ": x:" + ix + " y:" + iy + " width:" + iw
+ " height:" + ih);
if (value == JalviewFileChooser.APPROVE_OPTION)
{
java.io.File choice = chooser.getSelectedFile();
- JProgressBar progpanel = addProgressPanel("Saving jalview project "
- + choice.getName());
+ setProgressBar("Saving jalview project "
+ + choice.getName(), choice.hashCode());
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
// TODO catch and handle errors for savestate
- new Jalview2XML().SaveState(choice);
- removeProgressPanel(progpanel);
-
+ try {
+ new Jalview2XML().SaveState(choice);
+ } catch (OutOfMemoryError oom)
+ {
+ new OOMWarning("Whilst saving current state to "+choice.getName(), oom);
+ }
+ catch (Exception ex)
+ {
+ Cache.log.error("Problems whilst trying to save to "+choice.getName(),ex);
+ JOptionPane.showMessageDialog(this, "Error whilst saving current state to "+choice.getName(), "Couldn't save project", JOptionPane.WARNING_MESSAGE);
+ }
+ setProgressBar(null, choice.hashCode());
+
}
}
if (value == JalviewFileChooser.APPROVE_OPTION)
{
- String choice = chooser.getSelectedFile().getAbsolutePath();
- setProgressBar("loading jalview project "
- + chooser.getSelectedFile().getName(), choice.hashCode());
+ final String choice = chooser.getSelectedFile().getAbsolutePath();
jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
.getSelectedFile().getParent());
- new Jalview2XML().LoadJalviewAlign(choice);
+ new Thread(new Runnable() {
+ public void run() {
+ setProgressBar("loading jalview project "
+ + choice, choice.hashCode());
+ 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);
+ JOptionPane.showMessageDialog(Desktop.desktop, "Error whilst loading project from "+choice, "Couldn't load project", JOptionPane.WARNING_MESSAGE);
+ }
setProgressBar(null, choice.hashCode());
+ }
+ }).start();
}
}
return v_client;
}
+ /**
+ * flag set if jalview GUI is being operated programmatically
+ */
+ private boolean inBatchMode=false;
+
+ /**
+ * check if jalview GUI is being operated programmatically
+ * @return inBatchMode
+ */
+ public boolean isInBatchMode()
+ {
+ return inBatchMode;
+ }
+
+ /**
+ * set flag if jalview GUI is being operated programmatically
+ * @param inBatchMode
+ */
+ public void setInBatchMode(boolean inBatchMode)
+ {
+ this.inBatchMode = inBatchMode;
+ }
+
public void startServiceDiscovery()
{
try
{
- if (Cache.getDefault("SHOW_ENVISION2_SERVICES", true))
+ 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.
}
}
+ /**
+ * start a thread to open a URL in the configured browser. Pops up a warning dialog to the user if there is an exception when calling out to the browser to open the URL.
+ * @param url
+ */
+ public static void showUrl(final String url)
+ {
+ new Thread(new Runnable() {
+ public void run() {
+ try {
+ jalview.util.BrowserLauncher.openURL(url);
+ } catch (Exception ex)
+ {
+ JOptionPane
+ .showInternalMessageDialog(
+ Desktop.desktop,
+ "Unixers: Couldn't find default web browser."
+ + "\nAdd the full path to your browser in Preferences.",
+ "Web browser not found", JOptionPane.WARNING_MESSAGE);
+
+ ex.printStackTrace();
+ }
+ }
+ }).start();
+ }
+
+ public static WsParamSetManager wsparamManager = null;
+ public static ParamManager getUserParameterStore()
+ {
+ if (wsparamManager==null)
+ {
+ wsparamManager = new WsParamSetManager();
+ }
+ return wsparamManager;
+ }
+
}