import jalview.util.ArgParserUtils.BaseInfo;
import jalview.util.BrowserLauncher;
import jalview.util.ChannelProperties;
+import jalview.util.FileUtils;
import jalview.util.ImageMaker.TYPE;
import jalview.util.LaunchUtils;
import jalview.util.MessageManager;
: protocols.get(i);
FileFormatI format = null;
- if (fileName.endsWith(".jar"))
+ if (fileName.toLowerCase(Locale.ROOT).endsWith(".jar"))
{
format = FileFormat.Jalview;
-
}
else
{
format = new IdentifyFile().identify(file, protocol);
}
+ // If features/annotations/tree file that hasn't been put into the
+ // baseInfoMap, look through titles of opened AlignFrames to add.
+ String ext = FileUtils.getExtension(fileName);
+ boolean isFeatures = ArgParserUtils.featuresExtensions
+ .contains(ext);
+ boolean isAnnotations = ArgParserUtils.annotationsExtensions
+ .contains(ext);
+ boolean isTree = ArgParserUtils.treeExtensions.contains(ext);
+ if (isFeatures || isAnnotations || isTree)
+ {
+ String base = FileUtils.getBase(fileName);
+ AlignFrame matchingAf = null;
+ AlignFrame[] afs = Desktop.instance.getAlignFrames();
+ boolean dontSkip = false;
+ for (AlignFrame af : afs)
+ {
+ String afFilename = af.fileName;
+ String afTitle = af.getTitle();
+ /**
+ * don't need to check the matching afFilename or afTitle has an
+ * alignment extenstion. It's obviously an alignment!
+ */
+ /*
+ if ((base.equals(FileUtils.getBase(afFilename))
+ && ArgParserUtils.alignmentExtensions
+ .contains(FileUtils.getExtension(afFilename)))
+ || (base.equals(FileUtils.getBase(afTitle))
+ && ArgParserUtils.alignmentExtensions
+ .contains(FileUtils
+ .getExtension(afTitle))))
+ */
+ if (base.equals(FileUtils.getBase(afFilename))
+ || base.equals(FileUtils.getBase(afTitle)))
+ {
+ matchingAf = af;
+ break;
+ }
+ }
+ if (matchingAf != null)
+ {
+ if (isFeatures)
+ {
+ matchingAf.parseFeaturesFile(fileName,
+ AppletFormatAdapter.checkProtocol(fileName));
+ }
+ else if (isAnnotations)
+ {
+ matchingAf.loadJalviewDataFile(fileName, null, null, null);
+ }
+ else if (isTree)
+ {
+ try
+ {
+ NewickFile nf = new NewickFile(fileName,
+ AppletFormatAdapter.checkProtocol(fileName));
+ matchingAf.getViewport().setCurrentTree(matchingAf
+ .showNewickTree(nf, fileName).getTree());
+ } catch (IOException e)
+ {
+ jalview.bin.Console.warn(
+ "Couldn't add potential tree '" + fileName + "'");
+ dontSkip = true;
+ }
+ }
+ if (!dontSkip)
+ {
+ // skip to next file
+ continue;
+ }
+ }
+ }
+
if (file instanceof File)
{
Platform.cacheFileData((File) file);
af.showNewickTree(nf, treefile).getTree());
} catch (IOException e)
{
- jalview.bin.Console.warn("Couldn't add tree " + treefile,
- e);
+ jalview.bin.Console.warn(
+ "Couldn't add potential tree '" + treefile + "'");
}
}