Search in sources :

Example 1 with OpenUrlHyperlinkInfo

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

the class JstdConsoleView method initUI.

@Override
public void initUI() {
    super.initUI();
    if (myServer == null) {
        return;
    }
    TestTreeView treeView = this.getResultsViewer().getTreeView();
    TestTreeRenderer originalRenderer = ObjectUtils.tryCast(treeView.getCellRenderer(), TestTreeRenderer.class);
    if (originalRenderer != null) {
        myFormatter = new JstdRootTestProxyFormatter(myServer, treeView);
        originalRenderer.setAdditionalRootFormatter(myFormatter);
    }
    if (!myServer.isStopped() && myServer.getCapturedBrowsers().isEmpty()) {
        myServer.addLifeCycleListener(new JstdServerLifeCycleAdapter() {

            @Override
            public void onServerStarted() {
                print("To capture a browser open ", ConsoleViewContentType.SYSTEM_OUTPUT);
                String url = myServer.getServerUrl() + "/capture";
                printHyperlink(url, new OpenUrlHyperlinkInfo(url));
                print("\n", ConsoleViewContentType.SYSTEM_OUTPUT);
            }
        }, this);
    }
    myServer.addLifeCycleListener(new JstdServerLifeCycleAdapter() {

        @Override
        public void onServerTerminated(int exitCode) {
            print("JsTestDriver server finished with exit code " + exitCode + "\n", ConsoleViewContentType.SYSTEM_OUTPUT);
            JstdToolWindowManager.getInstance(getProperties().getProject()).show();
        }
    }, this);
}
Also used : TestTreeRenderer(com.intellij.execution.testframework.sm.runner.ui.TestTreeRenderer) OpenUrlHyperlinkInfo(com.intellij.ide.browsers.OpenUrlHyperlinkInfo) TestTreeView(com.intellij.execution.testframework.TestTreeView) JstdServerLifeCycleAdapter(com.google.jstestdriver.idea.server.JstdServerLifeCycleAdapter)

Example 2 with OpenUrlHyperlinkInfo

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

the class KarmaConsoleView method printBrowserCapturingSuggestion.

private void printBrowserCapturingSuggestion() {
    SMTestProxy.SMRootTestProxy rootNode = getResultsViewer().getTestsRootNode();
    rootNode.addLast(printer -> {
        printer.print("To capture a browser open ", ConsoleViewContentType.SYSTEM_OUTPUT);
        String url = myServer.formatUrl("/");
        printer.printHyperlink(url, new OpenUrlHyperlinkInfo(url));
        printer.print("\n", ConsoleViewContentType.SYSTEM_OUTPUT);
    });
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy) OpenUrlHyperlinkInfo(com.intellij.ide.browsers.OpenUrlHyperlinkInfo)

Aggregations

OpenUrlHyperlinkInfo (com.intellij.ide.browsers.OpenUrlHyperlinkInfo)2 JstdServerLifeCycleAdapter (com.google.jstestdriver.idea.server.JstdServerLifeCycleAdapter)1 TestTreeView (com.intellij.execution.testframework.TestTreeView)1 SMTestProxy (com.intellij.execution.testframework.sm.runner.SMTestProxy)1 TestTreeRenderer (com.intellij.execution.testframework.sm.runner.ui.TestTreeRenderer)1