import jalview.io.gff.SequenceOntologyFactory;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
+import jalview.util.HttpUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.ws.jws2.Jws2Discoverer;
* @j2sIgnore
*/
{
- if (!file.startsWith("http://") && !file.startsWith("https://"))
- // BH 2019 added https check for Java
+ if (!HttpUtils.startsWithHttpOrHttps(file))
{
if (!(new File(file)).exists())
{
import jalview.schemes.ColourSchemes;
import jalview.schemes.ResidueColourScheme;
import jalview.schemes.TCoffeeColourScheme;
+import jalview.util.HttpUtils;
import jalview.util.ImageMaker.TYPE;
import jalview.util.MessageManager;
import jalview.util.Platform;
Desktop.instance.closeAssociatedWindows();
FileLoader loader = new FileLoader();
- DataSourceType protocol = fileName.startsWith("http:")
+ DataSourceType protocol = HttpUtils.startsWithHttpOrHttps(fileName)
? DataSourceType.URL
: DataSourceType.FILE;
loader.LoadFile(viewport, fileName, protocol, currentFileFormat);
if (fileObject == null)
{
- DataSourceType protocol = (fileName.startsWith("http:")
+ DataSourceType protocol = HttpUtils.startsWithHttpOrHttps(fileName)
? DataSourceType.URL
- : DataSourceType.FILE);
+ : DataSourceType.FILE;
newframe = loader.LoadFileWaitTillLoaded(fileName, protocol,
currentFileFormat);
}
public void save_actionPerformed(ActionEvent e)
{
if (fileName == null || (currentFileFormat == null)
- || fileName.startsWith("http"))
+ || HttpUtils.startsWithHttpOrHttps(fileName))
{
saveAs_actionPerformed();
}
import java.awt.Rectangle;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
import jalview.gui.AppVarna;
+import jalview.gui.ChimeraViewFrame;
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
import jalview.gui.OOMWarning;
import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.Format;
+import jalview.util.HttpUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.StringUtils;
else
{
vamsasSeq = createVamsasSequence(id, jds);
-// vamsasSet.addSequence(vamsasSeq);
+ // vamsasSet.addSequence(vamsasSeq);
vamsasSet.getSequence().add(vamsasSeq);
vamsasSetIds.put(id, vamsasSeq);
seqRefIds.put(id, jds);
}
}
- //jms.setJGroup(groups);
+ // jms.setJGroup(groups);
Object group;
for (JGroup grp : groups)
{
viewportsAdded.clear();
frefedSequence = null;
- if (file.startsWith("http://")) {
- url = new URL(file);
- }
- final URL _url = url;
- return new jarInputStreamProvider() {
+ if (HttpUtils.startsWithHttpOrHttps(file))
+ {
+ url = new URL(file);
+ }
+ final URL _url = url;
+ return new jarInputStreamProvider()
+ {
@Override
public JarInputStream getJarInputStream() throws IOException {
return false;
}
+ public static boolean startsWithHttpOrHttps(String file)
+ {
+ return file.startsWith("http://") || file.startsWith("https://");
+ }
+
}