use of com.intellij.javascript.debugger.browserConnection.BrowserConnectionManager in project intellij-plugins by JetBrains.
the class OpenDartObservatoryUrlAction method openUrlInChromeFamilyBrowser.
/**
* Opens new tab in any already open Chrome-family browser, if none found - start any new Chrome-family browser
*/
public static void openUrlInChromeFamilyBrowser(@NotNull final String url) {
try {
final BrowserConnectionManager connectionManager = BrowserConnectionManager.getInstance();
final Client chromeClient = connectionManager.findClient(client -> {
final WebBrowser browser = connectionManager.getBrowser(client);
return browser != null && browser.getFamily() == BrowserFamily.CHROME;
});
if (chromeClient != null) {
BrowserConnectionManager.getInstance().openUrl(chromeClient, url);
} else {
openInAnyChromeFamilyBrowser(url);
}
} catch (Throwable t) {
// ClassNotFound in Community Edition or if JavaScriptDebug plugin disabled
openInAnyChromeFamilyBrowser(url);
}
}
Aggregations