diff --git a/src/main/java/org/broad/igv/ui/IGVMenuBar.java b/src/main/java/org/broad/igv/ui/IGVMenuBar.java index ab46607fa..0d1d91da4 100644 --- a/src/main/java/org/broad/igv/ui/IGVMenuBar.java +++ b/src/main/java/org/broad/igv/ui/IGVMenuBar.java @@ -194,14 +194,14 @@ private List createMenus() { log.error("Error creating google menu: " + e.getMessage()); } - try { - AWSMenu = createAWSMenu(); - AWSMenu.setVisible(AmazonUtils.isAwsProviderPresent()); - menus.add(AWSMenu); - } catch (IOException e) { - log.error("Error creating the Amazon AWS menu: " + e.getMessage()); - AWSMenu.setVisible(false); - } + + AWSMenu = createAWSMenu(); + AWSMenu.setVisible(false); + menus.add(AWSMenu); + //detecting the provider is slow, do it in another thread + LongRunningTask.submit(this::updateAWSMenu); + + menus.add(createHelpMenu()); @@ -211,7 +211,7 @@ private List createMenus() { } public void updateAWSMenu() { - AWSMenu.setVisible(AmazonUtils.isAwsProviderPresent()); + SwingUtilities.invokeLater(() -> AWSMenu.setVisible(AmazonUtils.isAwsProviderPresent())); } /** @@ -963,7 +963,7 @@ public void actionPerformed(ActionEvent actionEvent) { return menu; } - private JMenu createAWSMenu() throws IOException { + private JMenu createAWSMenu() { boolean usingCognito = AmazonUtils.GetCognitoConfig() != null; diff --git a/src/main/java/org/broad/igv/util/AmazonUtils.java b/src/main/java/org/broad/igv/util/AmazonUtils.java index 2df905a81..e832e5a67 100644 --- a/src/main/java/org/broad/igv/util/AmazonUtils.java +++ b/src/main/java/org/broad/igv/util/AmazonUtils.java @@ -83,7 +83,7 @@ public static JsonObject GetCognitoConfig() { /** - * Test to see if aws credentials are avaialable, either through IGV configuration of Cognito, or from the + * Test to see if aws credentials are available, either through IGV configuration of Cognito, or from the * default provider chain. See https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html#credentials-default * * @return diff --git a/src/main/java/org/broad/igv/util/LongRunningTask.java b/src/main/java/org/broad/igv/util/LongRunningTask.java index c3a64650f..a37d21804 100644 --- a/src/main/java/org/broad/igv/util/LongRunningTask.java +++ b/src/main/java/org/broad/igv/util/LongRunningTask.java @@ -40,9 +40,9 @@ * * @author jrobinso */ -public class LongRunningTask implements Callable { +public class LongRunningTask implements Callable { - private static Logger log = LogManager.getLogger(LongRunningTask.class); + private static final Logger log = LogManager.getLogger(LongRunningTask.class); private static final ExecutorService threadExecutor = Executors.newFixedThreadPool(5); @@ -52,7 +52,7 @@ public static Executor getThreadExecutor() { return threadExecutor; } - public static Future submit(Runnable runnable) { + public static Future submit(Runnable runnable) { if (Globals.isBatch()) { runnable.run(); return null; @@ -65,7 +65,8 @@ private LongRunningTask(Runnable runnable) { this.runnable = runnable; } - public Object call() { + @Override + public Void call() { CursorToken token = WaitCursorManager.showWaitCursor(); try {