Package com.intellij.execution.ui

Examples of com.intellij.execution.ui.ConsoleView


  public static synchronized SonarConsole get(Project project) {
    return project.getComponent(SonarConsole.class);
  }

  private ConsoleView createConsoleView(Project project) {
    final ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
    final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(SonarToolWindowFactory.TOOL_WINDOW_ID);
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        toolWindow.show(new Runnable() {
          @Override
          public void run() {
            Content content = toolWindow.getContentManager().getFactory().createContent(consoleView.getComponent(), "SonarQube Console", true);
            toolWindow.getContentManager().addContent(content);
          }
        });
      }
    });
View Full Code Here


    public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {

        NginxProcessHandler handler = NginxProcessHandler.create((NginxRunConfiguration) environment.getRunProfile());

        TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
        final ConsoleView console = builder != null ? builder.getConsole() : null;
        if (console != null) {
            console.addMessageFilter(new NginxConsoleFilter(project));
            console.attachToProcess(handler);
            handler.setConsole(console);
        }

        return new NginxExecutionResult(console, handler);
View Full Code Here

        if (runContentDescriptor != null) {
            if (runContentDescriptor.getProcessHandler() == null) {
                return;
            }

            final ConsoleView console = (ConsoleView) runContentDescriptor.getExecutionConsole();

            try {
                //the action will be disabled when there's no process handler, so no npe here. i hope...
                NginxProcessHandler processHandler = (NginxProcessHandler) runContentDescriptor.getProcessHandler();
                NginxServerDescriptor descriptor = processHandler.getDescriptor();

                //evil user may have deleted either server configuration
                validateDescriptor(descriptor);

                //it can be omitted for windows, but in linux we see silence if configuration file is invalid on reload
                //as reload is done by SIGHUP
                testConfig(descriptor, console, project);

                doReload(descriptor, console, project);

            } catch (ReloadException e) {
                console.print(e.getMessage() + "\n", ConsoleViewContentType.ERROR_OUTPUT);
            } catch (Exception e) {
                console.print(e.getClass() + " " + e.getMessage() + "\n", ConsoleViewContentType.ERROR_OUTPUT);
            }

        }

View Full Code Here

            public void run() {
                final IvyIdeaFacetConfiguration ivyIdeaFacetConfiguration = IvyIdeaFacetConfiguration.getInstance(module);
                if (ivyIdeaFacetConfiguration == null) {
                    throw new RuntimeException("Internal error: module " + module.getName() + " does not seem to be have an IvyIDEA facet, but was included in the resolve process anyway.");
                }
                final ConsoleView consoleView = IntellijUtils.getConsoleView(module.getProject());
                String configsForModule;
                if (ivyIdeaFacetConfiguration.isOnlyResolveSelectedConfigs()) {
                    final Set<String> configs = ivyIdeaFacetConfiguration.getConfigsToResolve();
                    if (configs == null || configs.size() == 0) {
                        configsForModule = "[No configurations selected!]";
                    } else {
                        configsForModule = configs.toString();
                    }
                } else {
                    configsForModule = "[All configurations]";
                }
                if (problems.isEmpty()) {
                    consoleView.print("No problems detected during resolve for module '" + module.getName() + "' " + configsForModule + ".\n", ConsoleViewContentType.NORMAL_OUTPUT);
                } else {
                    consoleView.print("Problems for module '" + module.getName() + " " + configsForModule + "':" + '\n', ConsoleViewContentType.NORMAL_OUTPUT);
                    for (ResolveProblem resolveProblem : problems) {
                        consoleView.print("\t" + resolveProblem.toString() + '\n', ConsoleViewContentType.ERROR_OUTPUT);
                    }
                    // Make sure the toolwindow becomes visible if there were problems
                    IntellijUtils.getToolWindow(module.getProject()).show(null);
                }
            }
View Full Code Here

    return null;
  }

  public static RunContentDescriptor createConsole(@NotNull Project project, final String tabTitle) {
    TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
    ConsoleView consoleView = builder.getConsole();

    DefaultActionGroup toolbarActions = new DefaultActionGroup();
    JComponent consoleComponent = new JPanel(new BorderLayout());

    JPanel toolbarPanel = new JPanel(new BorderLayout());
    toolbarPanel.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false).getComponent());
    consoleComponent.add(toolbarPanel, BorderLayout.WEST);
    consoleComponent.add(consoleView.getComponent(), BorderLayout.CENTER);

    RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, consoleComponent, tabTitle, null);

    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    for (AnAction action : consoleView.createConsoleActions()) {
      toolbarActions.add(action);
    }
    toolbarActions.add(new CloseAction(executor, descriptor, project));
    ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
    consoleView.allowHeavyFilters();
    return descriptor;
  }
View Full Code Here

  private static void showPubOutputConsole(@NotNull final Module module,
                                           @NotNull final GeneralCommandLine command,
                                           @NotNull final OSProcessHandler processHandler,
                                           @NotNull final VirtualFile pubspecYamlFile,
                                           @NotNull final String actionTitle) {
    final ConsoleView console;
    PubToolWindowContentInfo info = findExistingInfoForCommand(module.getProject(), command);

    if (info != null) {
      // rerunning the same pub command in the same tool window tab (corresponding tool window action invoked)
      console = info.console;
      console.clear();
    }
    else {
      console = createConsole(module.getProject(), pubspecYamlFile);
      info = new PubToolWindowContentInfo(module, pubspecYamlFile, command, actionTitle, console);

      final ActionToolbar actionToolbar = createToolWindowActionsBar(info);

      final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
      toolWindowPanel.setContent(console.getComponent());
      toolWindowPanel.setToolbar(actionToolbar.getComponent());

      final Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel.getComponent(), actionTitle, true);
      content.putUserData(PUB_TOOL_WINDOW_CONTENT_INFO_KEY, info);
      Disposer.register(content, console);

      final ContentManager contentManager = MessageView.SERVICE.getInstance(module.getProject()).getContentManager();
      removeOldTabs(contentManager);
      contentManager.addContent(content);
      contentManager.setSelectedContent(content);

      final ToolWindow toolWindow = ToolWindowManager.getInstance(module.getProject()).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
      toolWindow.activate(null, true);
    }

    info.rerunPubCommandAction.setProcessHandler(processHandler);
    info.stopProcessAction.setProcessHandler(processHandler);

    processHandler.addProcessListener(new ProcessAdapter() {
      @Override
      public void processTerminated(final ProcessEvent event) {
        console.print(IdeBundle.message("finished.with.exit.code.text.message", event.getExitCode()), ConsoleViewContentType.SYSTEM_OUTPUT);
      }
    });

    console.attachToProcess(processHandler);
    processHandler.startNotify();
  }
View Full Code Here

  }

  @Nullable
  @Override
  public JComponent getToolbarContextComponent() {
    final ConsoleView console = myConsole;
    return console == null ? null : console.getComponent();
  }
View Full Code Here

    return new RunProfileState() {
      @Override
      public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
        final ProcessHandler processHandler = new MyProcessHandler();

        final ConsoleView console = createConsole(getProject(), processHandler, env, executor);
        console.addMessageFilter(new CfmlStackTraceFilterProvider(getProject()));
        // processHandler.startNotify();
        runTests(processHandler);
        return new DefaultExecutionResult(console, processHandler);
      }
    };
View Full Code Here

      }

      @Nullable
      private ConsoleView createConsole(@NotNull final Executor executor, ProcessHandler processHandler) throws ExecutionException {
        // console view
        final ConsoleView testRunnerConsole;

        final String testFrameworkName = "cucumber";
        final CucumberJavaRunConfiguration runConfiguration = CucumberJavaRunConfiguration.this;
        final SMTRunnerConsoleProperties consoleProperties = new SMTRunnerConsoleProperties(runConfiguration, testFrameworkName, executor);

        testRunnerConsole = SMTestRunnerConnectionUtil.createAndAttachConsole(testFrameworkName, processHandler, consoleProperties,
                                                                              getEnvironment());

        return testRunnerConsole;
      }

      @NotNull
      @Override
      public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
        final ProcessHandler processHandler = startProcess();
        final ConsoleView console = createConsole(executor, processHandler);
        return new DefaultExecutionResult(console, processHandler, createActions(console, processHandler, executor));
      }
    };
  }
View Full Code Here

  public ExecutionResult executeWithServer(@Nullable JstdServer ideServer) throws ExecutionException {
    if (!myRunSettings.isExternalServerType() && ideServer == null) {
      throw new ExecutionException("[Internal error] Local JsTestDriver server running in IDE not found");
    }
    ProcessHandler processHandler = createProcessHandler(ideServer);
    ConsoleView consoleView = createSMTRunnerConsoleView(ideServer);
    consoleView.attachToProcess(processHandler);
    DefaultExecutionResult executionResult = new DefaultExecutionResult(consoleView, processHandler);
    executionResult.setRestartActions(new ToggleAutoTestAction(myEnvironment));
    return executionResult;
  }
View Full Code Here

TOP

Related Classes of com.intellij.execution.ui.ConsoleView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.