{
Transferable t = evt.getTransferable();
java.util.List files = null;
+ java.util.List protocols = null;
try
{
evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
String data = (String) t.getTransferData(uriListFlavor);
files = new java.util.ArrayList(1);
+ protocols = new java.util.ArrayList(1);
for (java.util.StringTokenizer st = new java.util.StringTokenizer(
data, "\r\n"); st.hasMoreTokens();)
{
// the line is a comment (as per the RFC 2483)
continue;
}
-
java.net.URI uri = new java.net.URI(s);
- java.io.File file = new java.io.File(uri);
- files.add(file);
+ if (uri.getScheme().toLowerCase().startsWith("http"))
+ {
+ protocols.add(FormatAdapter.URL);
+ files.add(uri.toString());
+ }
+ else
+ {
+ // otherwise preserve old behaviour: catch all for file objects
+ java.io.File file = new java.io.File(uri);
+ protocols.add(FormatAdapter.FILE);
+ files.add(file.toString());
+ }
}
}
} catch (Exception e)
for (int i = 0; i < files.size(); i++)
{
String file = files.get(i).toString();
- String protocol = FormatAdapter.FILE;
+ String protocol = (protocols==null) ? FormatAdapter.FILE : (String) protocols.get(i);
String format = null;
if (file.endsWith(".jar"))
if (value == JalviewFileChooser.APPROVE_OPTION)
{
java.io.File choice = chooser.getSelectedFile();
+ JProgressBar progpanel = addProgressPanel("Saving jalview project "+choice.getName());
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
+ // TODO catch and handle errors for savestate
new Jalview2XML().SaveState(choice);
+ removeProgressPanel(progpanel);
+
}
}
if (value == JalviewFileChooser.APPROVE_OPTION)
{
String choice = chooser.getSelectedFile().getAbsolutePath();
+ setProgressBar("loading jalview project "+chooser.getSelectedFile().getName(),choice.hashCode());
jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
.getSelectedFile().getParent());
new Jalview2XML().LoadJalviewAlign(choice);
+ setProgressBar(null,choice.hashCode());
}
}
*/
public boolean vamsasImport(File file)
{
- // TODO: create progress bar
if (v_client != null)
{
return false;
}
+ setProgressBar("Importing VAMSAS session from "+file.getName(),file.hashCode());
try
{
v_client = new jalview.gui.VamsasApplication(this, file,null);
} catch (Exception ex)
{
+ setProgressBar("Importing VAMSAS session from "+file.getName(),file.hashCode());
jalview.bin.Cache.log.error(
"New vamsas session from existing session file failed:", ex);
return false;
}
setupVamsasConnectedGui();
v_client.initial_update(); // TODO: thread ?
+ setProgressBar("Importing VAMSAS session from "+file.getName(),file.hashCode());
return v_client.inSession();
}
public boolean joinVamsasSession(String mysesid) {
if (value == JalviewFileChooser.APPROVE_OPTION)
{
java.io.File choice = chooser.getSelectedFile();
+ JProgressBar progpanel = addProgressPanel("Saving VAMSAS Document to "+choice.getName());
jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
String warnmsg = null;
String warnttl = null;
+ choice, ex);
}
+ removeProgressPanel(progpanel);
if (warnmsg != null)
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,