+ /**
+ * Break up and move to TreeParser?
+ */
+ public void chooseTreeUrl()
+ {
+
+ JLabel label = new JLabel(
+ MessageManager.getString("label.tree_url_example"));
+ // add "example" button
+ final JComboBox<String> history = new JComboBox<>();
+
+ JPanel panel = new JPanel(new GridLayout(2, 1));
+ panel.add(label);
+ panel.add(history);
+ history.setPreferredSize(new Dimension(400, 20));
+ history.setEditable(true);
+ history.addItem("http://www.");
+
+ String historyItems = jalview.bin.Cache.getProperty("RECENT_URL");
+
+ StringTokenizer st;
+
+ if (historyItems != null)
+ {
+ st = new StringTokenizer(historyItems, "\t");
+
+ while (st.hasMoreTokens())
+ {
+ history.addItem(st.nextToken());
+ }
+ }
+
+ int reply = JvOptionPane.showInternalConfirmDialog(this, panel,
+ MessageManager.getString("label.load_tree_url"),
+ JvOptionPane.OK_CANCEL_OPTION);
+
+ if (reply == JvOptionPane.OK_OPTION)
+ {
+
+ String urlString = history.getSelectedItem().toString();
+ URL treeUrl;
+
+ try
+ {
+ FileFormatI format = null;
+
+ format = new IdentifyFile().identify(urlString, DataSourceType.URL);
+ // add actual use for the format identification (jalview .jar files)
+ treeUrl = new URL(urlString);
+ AptxInit.createInstancesFromUrl(treeUrl, viewport);
+
+ } catch (IOException | RuntimeException e)
+ {
+ JvOptionPane.showMessageDialog(this, MessageManager.formatMessage(
+ "exception.failed_to_read_data_from_source", new String[]
+ { urlString }),
+ MessageManager.getString("label.url_not_found"),
+ JvOptionPane.ERROR_MESSAGE);
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+
+ }
+ }
+
+ /**
+ * Disgustingly hardcoded atm.
+ *
+ * @param databaseIndex
+ */
+ public void chooseTreeDb(int databaseIndex, String defaultIdentifier)
+ {
+ final WebservicesManager webservices_manager = WebservicesManager
+ .getInstance();
+ final PhylogeniesWebserviceClient client = webservices_manager
+ .getAvailablePhylogeniesWebserviceClient(databaseIndex);
+ String identifier = JvOptionPane
+ .showInternalInputDialog(Desktop.desktop,
+ client.getInstructions() + "\n(Reference: "
+ + client.getReference() + ")",
+ client.getDescription(), JvOptionPane.QUESTION_MESSAGE,
+ null, null, defaultIdentifier)
+ .toString();
+
+ AptxInit.createInstancesFromDb(client, identifier, viewport);
+ }
+