- Runnable action = new Runnable() {
- @Override
- public void run() {
- @SuppressWarnings("unchecked")
- String url = (history instanceof JTextField ? ((JTextField) history).getText()
- : ((JComboBox<String>) history).getEditor().getItem().toString().trim());
-
- if (url.toLowerCase(Locale.ROOT).endsWith(".jar")) {
- if (viewport != null) {
- new FileLoader().LoadFile(viewport, url, DataSourceType.URL, FileFormat.Jalview);
- } else {
- new FileLoader().LoadFile(url, DataSourceType.URL, FileFormat.Jalview);
- }
- } else {
- FileFormatI format = null;
- try {
- format = new IdentifyFile().identify(url, DataSourceType.URL);
- } catch (FileFormatException e) {
- // TODO revise error handling, distinguish between
- // URL not found and response not valid
- }
-
- if (format == null) {
- String msg = MessageManager.formatMessage("label.couldnt_locate", url);
- JvOptionPane.showInternalMessageDialog(Desktop.desktop, msg,
- MessageManager.getString("label.url_not_found"), JvOptionPane.WARNING_MESSAGE);
+ Runnable action = () -> {
+ @SuppressWarnings("unchecked")
+ String url = (history instanceof JTextField
+ ? ((JTextField) history).getText()
+ : ((JComboBox<String>) history).getEditor().getItem()
+ .toString().trim());
+
+ if (url.toLowerCase(Locale.ROOT).endsWith(".jar"))
+ {
+ if (viewport != null)
+ {
+ new FileLoader().LoadFile(viewport, url, DataSourceType.URL,
+ FileFormat.Jalview);
+ }
+ else
+ {
+ new FileLoader().LoadFile(url, DataSourceType.URL,
+ FileFormat.Jalview);
+ }
+ }
+ else
+ {
+ FileFormatI format = null;
+ try
+ {
+ format = new IdentifyFile().identify(url, DataSourceType.URL);
+ } catch (FileFormatException e)
+ {
+ // TODO revise error handling, distinguish between
+ // URL not found and response not valid
+ }