From: tcofoegbu Date: Tue, 1 Nov 2016 15:41:32 +0000 (+0000) Subject: JAL-2280 refactored and improved structure file identification code for drog'n'drop... X-Git-Tag: Release_2_10_1^2~20 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c96c7cbd9b1cf8b2f0c0715180e698f6c3f657d1;p=jalview.git JAL-2280 refactored and improved structure file identification code for drog'n'drop on AlignFrame to StructureFile class --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index e8b865b..20fa657 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -71,6 +71,7 @@ import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; import jalview.io.JnetAnnotationMaker; import jalview.io.NewickFile; +import jalview.io.StructureFile; import jalview.io.TCoffeeScoreFile; import jalview.jbgui.GAlignFrame; import jalview.schemes.Blosum62ColourScheme; @@ -4885,8 +4886,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (type != null) { - if (type.equalsIgnoreCase("PDB") - || type.equalsIgnoreCase("mmCIF")) + if (StructureFile.isStructureFile(type)) { filesmatched.add(new Object[] { file, protocol, mtch }); continue; diff --git a/src/jalview/io/StructureFile.java b/src/jalview/io/StructureFile.java index 26c202c..97b246f 100644 --- a/src/jalview/io/StructureFile.java +++ b/src/jalview/io/StructureFile.java @@ -45,6 +45,11 @@ public abstract class StructureFile extends AlignFile private String id; + public enum StructureFileType + { + PDB, MMCIF, MMTF + }; + private PDBEntry.Type dbRefType; /** @@ -484,4 +489,20 @@ public abstract class StructureFile extends AlignFile { this.pdbIdAvailable = pdbIdAvailable; } + + public static boolean isStructureFile(String fileType) + { + if (fileType == null) + { + return false; + } + for (StructureFileType sfType : StructureFileType.values()) + { + if (sfType.name().equalsIgnoreCase(fileType)) + { + return true; + } + } + return false; + } }