Search in sources :

Example 1 with WebBrowser

use of com.intellij.ide.browsers.WebBrowser in project kotlin by JetBrains.

the class K2JSRunConfigurationEditor method setUpBrowserCombobox.

private void setUpBrowserCombobox() {
    for (WebBrowser browser : WebBrowserManager.getInstance().getActiveBrowsers()) {
        browserComboBox.addItem(browser.getFamily());
    }
    browserComboBox.setRenderer(new ListCellRendererWrapper<BrowserFamily>() {

        @Override
        public void customize(JList list, BrowserFamily family, int index, boolean selected, boolean hasFocus) {
            if (family != null) {
                setText(family.getName());
                setIcon(family.getIcon());
            }
        }
    });
    if (browserComboBox.getItemCount() < 2) {
        browserComboBox.setVisible(false);
        browserComboBox.setVisible(false);
    } else {
        browserComboBox.setSelectedItem(0);
    }
}
Also used : WebBrowser(com.intellij.ide.browsers.WebBrowser) BrowserFamily(com.intellij.ide.browsers.BrowserFamily)

Example 2 with WebBrowser

use of com.intellij.ide.browsers.WebBrowser in project kotlin by JetBrains.

the class K2JSRunnerUtils method openBrowser.

public static void openBrowser(@NotNull K2JSConfigurationSettings configurationSettings) {
    if (!configurationSettings.isShouldOpenInBrowserAfterTranslation()) {
        return;
    }
    String filePath = configurationSettings.getPageToOpenFilePath();
    String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, filePath);
    WebBrowser browser = WebBrowserManager.getInstance().findBrowserById(configurationSettings.getBrowserFamily().getName());
    BrowserLauncher.getInstance().browse(url, browser);
}
Also used : WebBrowser(com.intellij.ide.browsers.WebBrowser)

Example 3 with WebBrowser

use of com.intellij.ide.browsers.WebBrowser in project intellij-plugins by JetBrains.

the class DartiumUtil method applyDartiumSettings.

public static void applyDartiumSettings(@NotNull final String dartiumPathFromUI, @NotNull final ChromeSettings dartiumSettingsFromUI) {
    final WebBrowser dartiumInitial = getDartiumBrowser();
    final String dartiumPathInitial = dartiumInitial == null ? null : dartiumInitial.getPath();
    if (!dartiumPathFromUI.isEmpty() && new File(dartiumPathFromUI).exists() && !dartiumPathFromUI.equals(dartiumPathInitial)) {
        DartSdkUtil.updateKnownDartiumPaths(dartiumPathInitial, dartiumPathFromUI);
        final WebBrowser browser = ensureDartiumBrowserConfigured(dartiumPathFromUI);
        if (!dartiumSettingsFromUI.equals(browser.getSpecificSettings())) {
            WebBrowserManager.getInstance().setBrowserSpecificSettings(browser, dartiumSettingsFromUI);
        }
        return;
    }
    if (dartiumInitial != null && !dartiumSettingsFromUI.equals(dartiumInitial.getSpecificSettings())) {
        WebBrowserManager.getInstance().setBrowserSpecificSettings(dartiumInitial, dartiumSettingsFromUI);
    }
}
Also used : WebBrowser(com.intellij.ide.browsers.WebBrowser) File(java.io.File)

Example 4 with WebBrowser

use of com.intellij.ide.browsers.WebBrowser in project intellij-plugins by JetBrains.

the class KarmaDebugBrowserSelector method selectDebugEngine.

@Nullable
public DebuggableWebBrowser selectDebugEngine() {
    List<DebuggableWebBrowser> allDebuggableActiveBrowsers = toDebuggableWebBrowsers(WebBrowserManager.getInstance().getActiveBrowsers());
    List<DebuggableWebBrowser> capturedDebuggableActiveBrowsers = filterCaptured(allDebuggableActiveBrowsers);
    if (capturedDebuggableActiveBrowsers.size() == 1) {
        DebuggableWebBrowser debuggableWebBrowser = capturedDebuggableActiveBrowsers.get(0);
        setWebBrowserToReuse(null);
        return ObjectUtils.assertNotNull(debuggableWebBrowser);
    }
    WebBrowser browserToReuse = getWebBrowserToReuse();
    if (browserToReuse != null) {
        DebuggableWebBrowser debuggableBrowser = DebuggableWebBrowser.create(browserToReuse);
        if (debuggableBrowser != null) {
            return debuggableBrowser;
        }
    }
    if (capturedDebuggableActiveBrowsers.isEmpty() && allDebuggableActiveBrowsers.size() == 1) {
        return ObjectUtils.assertNotNull(allDebuggableActiveBrowsers.get(0));
    }
    printSupportedBrowsers(allDebuggableActiveBrowsers, capturedDebuggableActiveBrowsers);
    return null;
}
Also used : WebBrowser(com.intellij.ide.browsers.WebBrowser) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with WebBrowser

use of com.intellij.ide.browsers.WebBrowser in project intellij-plugins by JetBrains.

the class KarmaDebugProgramRunner method createDescriptor.

@NotNull
private static RunContentDescriptor createDescriptor(@NotNull ExecutionEnvironment environment, @NotNull ExecutionResult executionResult, @NotNull KarmaConsoleView consoleView, @NotNull KarmaServer karmaServer, @NotNull DebuggableWebBrowser debuggableWebBrowser) throws ExecutionException {
    Url url = Urls.newFromEncoded(karmaServer.formatUrl("/"));
    DebuggableFileFinder fileFinder = getDebuggableFileFinder(karmaServer);
    XDebugSession session = XDebuggerManager.getInstance(environment.getProject()).startSession(environment, new XDebugProcessStarter() {

        @Override
        @NotNull
        public XDebugProcess start(@NotNull XDebugSession session) {
            JavaScriptDebugEngine debugEngine = debuggableWebBrowser.getDebugEngine();
            WebBrowser browser = debuggableWebBrowser.getWebBrowser();
            JavaScriptDebugProcess<? extends VmConnection> debugProcess = debugEngine.createDebugProcess(session, browser, fileFinder, url, executionResult, true);
            debugProcess.addFirstLineBreakpointPattern("\\.browserify$");
            debugProcess.setElementsInspectorEnabled(false);
            debugProcess.setConsoleMessagesSupportEnabled(false);
            debugProcess.setLayouter(consoleView.createDebugLayouter(debugProcess));
            Alarm alarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, consoleView);
            alarm.addRequest(() -> {
                resumeTestRunning(executionResult.getProcessHandler());
                Disposer.dispose(alarm);
            }, 2000);
            return debugProcess;
        }
    });
    return session.getRunContentDescriptor();
}
Also used : JavaScriptDebugProcess(com.intellij.javascript.debugger.JavaScriptDebugProcess) XDebugSession(com.intellij.xdebugger.XDebugSession) VmConnection(org.jetbrains.debugger.connection.VmConnection) XDebugProcess(com.intellij.xdebugger.XDebugProcess) WebBrowser(com.intellij.ide.browsers.WebBrowser) XDebugProcessStarter(com.intellij.xdebugger.XDebugProcessStarter) Alarm(com.intellij.util.Alarm) NotNull(org.jetbrains.annotations.NotNull) Url(com.intellij.util.Url) DebuggableFileFinder(com.intellij.javascript.debugger.DebuggableFileFinder) JavaScriptDebugEngine(com.intellij.javascript.debugger.JavaScriptDebugEngine) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

WebBrowser (com.intellij.ide.browsers.WebBrowser)10 JavaScriptDebugEngine (com.intellij.javascript.debugger.JavaScriptDebugEngine)2 Url (com.intellij.util.Url)2 Nullable (org.jetbrains.annotations.Nullable)2 JstdBrowserInfo (com.google.jstestdriver.idea.server.JstdBrowserInfo)1 RunManager (com.intellij.execution.RunManager)1 RunnerAndConfigurationSettings (com.intellij.execution.RunnerAndConfigurationSettings)1 BrowserFamily (com.intellij.ide.browsers.BrowserFamily)1 BrowserSpecificSettings (com.intellij.ide.browsers.BrowserSpecificSettings)1 ChromeSettings (com.intellij.ide.browsers.chrome.ChromeSettings)1 DebuggableFileFinder (com.intellij.javascript.debugger.DebuggableFileFinder)1 JavaScriptDebugProcess (com.intellij.javascript.debugger.JavaScriptDebugProcess)1 BrowserConnectionManager (com.intellij.javascript.debugger.browserConnection.BrowserConnectionManager)1 JavaScriptDebugConfiguration (com.intellij.javascript.debugger.execution.JavaScriptDebugConfiguration)1 Alarm (com.intellij.util.Alarm)1 SmartList (com.intellij.util.SmartList)1 XDebugProcess (com.intellij.xdebugger.XDebugProcess)1 XDebugProcessStarter (com.intellij.xdebugger.XDebugProcessStarter)1 XDebugSession (com.intellij.xdebugger.XDebugSession)1 File (java.io.File)1