@Override protected void browseUsingNotSystemDefaultBrowserPolicy( @NotNull URI uri, @NotNull GeneralSettings settings, @Nullable Project project) { WebBrowserManager browserManager = WebBrowserManager.getInstance(); if (browserManager.getDefaultBrowserPolicy() == DefaultBrowserPolicy.FIRST || (SystemInfo.isMac && "open".equals(settings.getBrowserPath()))) { WebBrowser browser = browserManager.getFirstActiveBrowser(); if (browser != null) { browseUsingPath(uri.toString(), null, browser, project, ArrayUtil.EMPTY_STRING_ARRAY); return; } } super.browseUsingNotSystemDefaultBrowserPolicy(uri, settings, project); }
@Nullable public static WebBrowser findUsingBrowser() { WebBrowserManager browserManager = WebBrowserManager.getInstance(); DefaultBrowserPolicy defaultBrowserPolicy = browserManager.getDefaultBrowserPolicy(); if (defaultBrowserPolicy == DefaultBrowserPolicy.FIRST || (defaultBrowserPolicy == DefaultBrowserPolicy.SYSTEM && !BrowserLauncherAppless.canUseSystemDefaultBrowserPolicy())) { return browserManager.getFirstActiveBrowser(); } else if (defaultBrowserPolicy == DefaultBrowserPolicy.ALTERNATIVE) { String path = GeneralSettings.getInstance().getBrowserPath(); if (!StringUtil.isEmpty(path)) { WebBrowser browser = browserManager.findBrowserById(path); if (browser == null) { for (WebBrowser item : browserManager.getActiveBrowsers()) { if (path.equals(item.getPath())) { return item; } } } } } return null; }