diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/launch/debug/ReadaptDebugDelegate.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/launch/debug/ReadaptDebugDelegate.java index 06ad3f9..9b54769 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/launch/debug/ReadaptDebugDelegate.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/launch/debug/ReadaptDebugDelegate.java @@ -74,10 +74,11 @@ private void displayNotFoundWarning() { + "after running \"gem install readapt\" in a terminal." + System.lineSeparator() + System.lineSeparator() + "Please restart the debug session once installation is complete.", MessageDialog.WARNING, 0, "Install gem", "Specify path"); - if (notFoundDialog.open() == 0) { // First button index, install. + int buttonIndex = notFoundDialog.open(); + if (buttonIndex == 0) { GemHelper.install("Readapt", READAPT_PATH); HAS_UPDATED_READAPT.set(true); - } else { + } else if (buttonIndex == 1) { PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(null, PreferencePage.PAGE_ID, null, null); ((PreferencePage) preferenceDialog.getSelectedPage()).getPathField("readapt").setFocus(); diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/server/SolargraphStreamConnectionProvider.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/server/SolargraphStreamConnectionProvider.java index 9f1e189..c451f51 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/server/SolargraphStreamConnectionProvider.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/server/SolargraphStreamConnectionProvider.java @@ -70,10 +70,11 @@ private void displayNotFoundWarning() { "Key features will not be available. Let Eclipse install the gem locally or specify its path " + "after running \"gem install solargraph\" in a terminal.", MessageDialog.WARNING, 0, "Install gem", "Specify path"); - if (notFoundDialog.open() == 0) { // First button index, install. + int buttonIndex = notFoundDialog.open(); + if (buttonIndex == 0) { GemHelper.install("Solargraph", GEM_PATH); HAS_UPDATED_SOLARGRAPH.set(true); - } else { + } else if (buttonIndex == 1) { PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(null, PreferencePage.PAGE_ID, null, null); ((PreferencePage) preferenceDialog.getSelectedPage()).getPathField("solargraph").setFocus(); diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/GemHelper.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/GemHelper.java index ad7236e..1c7afd9 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/GemHelper.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/GemHelper.java @@ -72,14 +72,15 @@ private static void displayInstallationError(String gem) { null, "Please open the Error Log view for details. To manually install it, run \"gem install " + gem.toLowerCase() + "\" in a terminal and specify the path in the plugin's preferences.", MessageDialog.ERROR, 0, "Open error logs", "Specify path"); - if (errorDialog.open() == 0) { // First button index, open Error Log. + int buttonIndex = errorDialog.open(); + if (buttonIndex == 0) { try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView("org.eclipse.pde.runtime.LogView"); } catch (PartInitException e) { LogHelper.error("Failed to open Error Log view.", e); } - } else { + } else if (buttonIndex == 1) { PreferenceDialog prefDialog = PreferencesUtil.createPreferenceDialogOn(null, PreferencePage.PAGE_ID, null, null); ((PreferencePage) prefDialog.getSelectedPage()).getPathField(gem).setFocus(); prefDialog.open();