git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
20c3a3b
)
drag'n'drop a URL on to an alignment
author
jprocter
<Jim Procter>
Fri, 19 Jun 2009 09:55:34 +0000
(09:55 +0000)
committer
jprocter
<Jim Procter>
Fri, 19 Jun 2009 09:55:34 +0000
(09:55 +0000)
src/jalview/gui/AlignFrame.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/AlignFrame.java
b/src/jalview/gui/AlignFrame.java
index
d8459a9
..
d5a98fe
100755
(executable)
--- a/
src/jalview/gui/AlignFrame.java
+++ b/
src/jalview/gui/AlignFrame.java
@@
-4087,8
+4087,17
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
java.net.URI uri = new java.net.URI(s);
}
java.net.URI uri = new java.net.URI(s);
- java.io.File file = new java.io.File(uri);
- files.add(file);
+ // check to see if we can handle this kind of URI
+ if (uri.getScheme().toLowerCase().startsWith("http"))
+ {
+ files.add(uri.toString());
+ }
+ else
+ {
+ // otherwise preserve old behaviour: catch all for file objects
+ java.io.File file = new java.io.File(uri);
+ files.add(file.toString());
+ }
}
}
} catch (Exception e)
}
}
} catch (Exception e)
@@
-4112,7
+4121,7
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
}
/**
}
/**
- * Attempt to load a "dropped" file: First by testing whether it's and
+ * Attempt to load a "dropped" file or URL string: First by testing whether it's and
* Annotation file, then a JNet file, and finally a features file. If all are
* false then the user may have dropped an alignment file onto this
* AlignFrame.
* Annotation file, then a JNet file, and finally a features file. If all are
* false then the user may have dropped an alignment file onto this
* AlignFrame.
@@
-4124,11
+4133,11
@@
public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
try
{
{
try
{
- String protocol = "File";
-
- if (file.indexOf("http:") > -1 || file.indexOf("file:") > -1)
+ String protocol = jalview.io.FormatAdapter.FILE;
+ String f=file.toLowerCase();
+ if (f.indexOf("http:") == 0 || f.indexOf("https:")==0 || f.indexOf("file:") == 0)
{
{
- protocol = "URL";
+ protocol = jalview.io.FormatAdapter.URL;
}
boolean isAnnotation = new AnnotationFile().readAnnotationFile(
}
boolean isAnnotation = new AnnotationFile().readAnnotationFile(