JAL-2422 pull-up refactoring of structure commands (continued)
[jalview.git] / src / jalview / structure / StructureCommandsFactory.java
diff --git a/src/jalview/structure/StructureCommandsFactory.java b/src/jalview/structure/StructureCommandsFactory.java
new file mode 100644 (file)
index 0000000..9319427
--- /dev/null
@@ -0,0 +1,32 @@
+package jalview.structure;
+
+import jalview.ext.jmol.JmolCommands;
+import jalview.ext.rbvi.chimera.ChimeraCommands;
+import jalview.ext.rbvi.chimera.ChimeraXCommands;
+import jalview.gui.StructureViewer.ViewerType;
+
+/**
+ * A factory that serves a class that can generate structure commands for a
+ * specified structure viewer
+ */
+public class StructureCommandsFactory
+{
+  public StructureCommandsI getStructureCommands(ViewerType viewer)
+  {
+    StructureCommandsI commands = null;
+    switch (viewer)
+    {
+    case JMOL:
+      commands = new JmolCommands();
+      break;
+    case CHIMERA:
+      commands = new ChimeraCommands();
+      break;
+    case CHIMERAX:
+      commands = new ChimeraXCommands();
+      break;
+    default:
+    }
+    return commands;
+  }
+}