+ jalview.io.JalviewFileChooser chooser\r
+ = new jalview.io.JalviewFileChooser(jalview.bin.Cache.\r
+ getProperty(\r
+ "LAST_DIRECTORY"));\r
+ chooser.setFileView(new jalview.io.JalviewFileView());\r
+ chooser.setDialogTitle("Select a PDB file");\r
+ chooser.setToolTipText("Load a PDB file");\r
+\r
+ int value = chooser.showOpenDialog(null);\r
+\r
+ if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+ {\r
+ PDBEntry entry = new PDBEntry();\r
+ String choice = chooser.getSelectedFile().getPath();\r
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
+ try\r
+ {\r
+ MCview.PDBfile pdbfile = new MCview.PDBfile(choice,\r
+ jalview.io.AppletFormatAdapter.FILE);\r
+\r
+ if (pdbfile.id == null)\r
+ {\r
+ String reply = JOptionPane.showInternalInputDialog(\r
+ Desktop.desktop,\r
+ "Couldn't find a PDB id in the file supplied."\r
+ + "Please enter an Id to identify this structure.",\r
+ "No PDB Id in File", JOptionPane.QUESTION_MESSAGE);\r
+ if (reply == null)\r
+ return;\r
+\r
+ entry.setId(reply);\r
+ }\r
+ else\r
+ entry.setId(pdbfile.id);\r
+ }\r
+ catch (java.io.IOException ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r