+public void chooseTreeFile() {
+ // Pick the tree file
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(
+ MessageManager.getString("label.select_newick_like_tree_file")); // modify
+ chooser.setToolTipText(
+ MessageManager.getString("label.load_tree_for_sequence_set"));
+ for (SupportedTreeFileFilter treeFormat : SupportedTreeFileFilter
+ .values())
+ {
+ chooser.setFileFilter(treeFormat.getTreeFilter());
+ }
+
+ int value = chooser.showOpenDialog(null);
+
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ String filePath = chooser.getSelectedFile().getPath();
+ Cache.setProperty("LAST_DIRECTORY", filePath);
+
+ TreeParser treeParser = new TreeParser(filePath);
+ treeParser.loadTree(viewport);
+
+ }
+ }
+
+ public void chooseTreeUrl()
+ {
+ URL treeUrl;
+
+ String urlString = JvOptionPane.showInputDialog(this,
+ MessageManager.getString("label.tree_url_example"),
+ MessageManager.getString("label.load_tree_url"),
+ JvOptionPane.QUESTION_MESSAGE);
+ if ((urlString != null) && (!urlString.isEmpty()))
+ {
+ try
+ {
+ treeUrl = new URL(urlString);
+ AptxInit.createInstanceFromUrl(treeUrl);
+
+ } catch (MalformedURLException 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);
+ }
+
+ }
+
+
+ // final String url_string = JOptionPane
+ // .showInputDialog( this,
+ // message,
+ // "Use URL/webservice to obtain a phylogeny",
+ // JOptionPane.QUESTION_MESSAGE );
+ // boolean nhx_or_nexus = false;
+ // if ( ( url_string != null ) && ( url_string.length() > 0 ) ) {
+ // try {
+ // url = new URL( url_string );
+ }