当前位置: 首页>>代码示例>>Java>>正文


Java ConsoleView.attachToProcess方法代码示例

本文整理汇总了Java中com.intellij.execution.ui.ConsoleView.attachToProcess方法的典型用法代码示例。如果您正苦于以下问题:Java ConsoleView.attachToProcess方法的具体用法?Java ConsoleView.attachToProcess怎么用?Java ConsoleView.attachToProcess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.ui.ConsoleView的用法示例。


在下文中一共展示了ConsoleView.attachToProcess方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
public void run() {
  FileDocumentManager.getInstance().saveAllDocuments();

  // Use user-provided console if exist. Create new otherwise
  ConsoleView view = (myUserProvidedConsole != null ? myUserProvidedConsole :  createConsole(myProject));
  view.attachToProcess(myProcess);
  if (myAfterCompletion != null) {
    myProcess.addProcessListener(new ProcessAdapter() {
      @Override
      public void processTerminated(ProcessEvent event) {
        SwingUtilities.invokeLater(myAfterCompletion);
      }
    });
  }
  myProcess.startNotify();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RunContentExecutor.java

示例2: initConsoleUi

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
protected ConsoleView initConsoleUi() {
  ConsoleView consoleView = createConsoleView();
  consoleView.print(myCommandLine.getCommandLineString() + '\n', ConsoleViewContentType.USER_INPUT);
  consoleView.attachToProcess(myProcessHandler);

  JPanel panel = new JPanel(new BorderLayout());

  DefaultActionGroup toolbarActions = new DefaultActionGroup();
  ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
  panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
  panel.add(consoleView.getComponent(), BorderLayout.CENTER);
  actionToolbar.setTargetComponent(panel);

  toolbarActions.addAll(consoleView.createConsoleActions());
  fillToolBarActions(toolbarActions);
  panel.updateUI();

  Executor defaultExecutor = DefaultRunExecutor.getRunExecutorInstance();
  final RunContentDescriptor contentDescriptor = new RunContentDescriptor(consoleView, myProcessHandler, panel, myTitle);
  showConsole(defaultExecutor, contentDescriptor);

  myProcessHandler.addProcessListener(new ConsoleListener(myProject, defaultExecutor, myProcessHandler));
  myProcessHandler.startNotify();
  return consoleView;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ExternalToolRunner.java

示例3: callProtractor

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
private void callProtractor() {
    try {
        Config config = Config.getInstance(project);

        if (config == null) {
            return;
        }

        GeneralCommandLine command = getProtractorRunCommand(config);
        Process p = command.createProcess();

        if (project != null) {
            ToolWindowManager manager = ToolWindowManager.getInstance(project);
            String id = "Gherkin Runner";
            TextConsoleBuilderFactory factory = TextConsoleBuilderFactory.getInstance();
            TextConsoleBuilder builder = factory.createBuilder(project);
            ConsoleView view = builder.getConsole();

            ColoredProcessHandler handler = new ColoredProcessHandler(p, command.getPreparedCommandLine());
            handler.startNotify();
            view.attachToProcess(handler);

            ToolWindow window = manager.getToolWindow(id);
            Icon cucumberIcon = IconLoader.findIcon("/resources/icons/cucumber.png");

            if (window == null) {
                window = manager.registerToolWindow(id, true, ToolWindowAnchor.BOTTOM);
                window.setIcon(cucumberIcon);
            }

            ContentFactory cf = window.getContentManager().getFactory();
            Content c = cf.createContent(view.getComponent(), "Run " + (window.getContentManager().getContentCount() + 1), true);

            window.getContentManager().addContent(c);
        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}
 
开发者ID:KariiO,项目名称:Gherkin-TS-Runner,代码行数:40,代码来源:GherkinIconRenderer.java

示例4: execute

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
public ExecutionResult execute(@NotNull final Executor executor,
                               @NotNull ProgramRunner runner) throws ExecutionException {
    log.info("execute " + executor.getActionName());

    final ProcessHandler processHandler = startProcess();
    final TextConsoleBuilder builder = getConsoleBuilder();
    final ConsoleView console = builder != null ? builder.getConsole() : null;
    if (console != null) {
        console.attachToProcess(processHandler);
    }

    VirtualFile file = LocalFileSystem.getInstance().findFileByPath(
            ((LuaRunConfigurationParams) getRunConfiguration()).getScriptName());

    final String text;
    if (file != null) {
        final Document document = FileDocumentManager.getInstance().getDocument(file);
        if (document != null) {
            text = document.getText();
        } else
            text = "";
    } else
        text = "";

    if (KahLuaInterpreterWindowFactory.INSTANCE != null) {
        KahLuaInterpreterWindowFactory.WINDOW
                                      .activate(KahLuaInterpreterWindowFactory.INSTANCE.getRunnableExecution(text),
                                              true);
    }

    return new KahluaExecutionResult(console, createActions(console, processHandler, executor));
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:33,代码来源:KahluaCommandLineState.java

示例5: attachExecutionConsole

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@NotNull
@Override
public ExecutionConsole attachExecutionConsole(@NotNull ExternalSystemTask task,
                                               @NotNull Project project,
                                               @NotNull ExternalSystemRunConfiguration configuration,
                                               @NotNull Executor executor,
                                               @NotNull ExecutionEnvironment env,
                                               @NotNull ProcessHandler processHandler) throws ExecutionException {
  myProcessHandler = processHandler;
  ConsoleView executionConsole = new TextConsoleBuilderImpl(project).getConsole();
  executionConsole.attachToProcess(processHandler);
  return executionConsole;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DefaultExternalSystemExecutionConsoleManager.java

示例6: execute

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@Override
@NotNull
public ExecutionResult execute(@NotNull final Executor executor, @NotNull final ProgramRunner runner) throws ExecutionException {
  final ProcessHandler processHandler = startProcess();
  final ConsoleView console = createConsole(executor);
  if (console != null) {
    console.attachToProcess(processHandler);
  }
  return new DefaultExecutionResult(console, processHandler, createActions(console, processHandler, executor));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CommandLineState.java

示例7: createAndAttachConsole

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@NotNull
protected ConsoleView createAndAttachConsole(Project project, ProcessHandler processHandler, Executor executor)
  throws ExecutionException {
  final ConsoleView consoleView = createConsoleBuilder(project).getConsole();
  consoleView.addMessageFilter(createUrlFilter(processHandler));

  addTracebackFilter(project, consoleView, processHandler);

  consoleView.attachToProcess(processHandler);
  return consoleView;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PythonCommandLineState.java

示例8: attachConsole

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@NotNull
@Override
protected ConsoleView attachConsole(AndroidRunningState state, Executor executor) {
  Project project = getConfigurationModule().getProject();
  final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
  ConsoleView console = builder.getConsole();
  console.attachToProcess(state.getProcessHandler());
  return console;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AndroidRunConfiguration.java

示例9: createAndAttach

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@NotNull
@Override
public ConsoleView createAndAttach(
    @NotNull Disposable parent, @NotNull ProcessHandler handler, @NotNull Executor executor)
    throws ExecutionException {
  final TextConsoleBuilder builder =
      TextConsoleBuilderFactory.getInstance().createBuilder(project);
  ConsoleView console = builder.getConsole();
  console.attachToProcess(handler);
  return console;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:12,代码来源:BlazeAndroidBinaryConsoleProvider.java

示例10: createAndAttach

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
@Override
public ConsoleView createAndAttach(Disposable parent, ProcessHandler handler, Executor executor)
    throws ExecutionException {
  switch (configState.getLaunchMethod()) {
    case BLAZE_TEST:
      ConsoleView console = createBlazeTestConsole(executor);
      console.attachToProcess(handler);
      return console;
    case NON_BLAZE:
    case MOBILE_INSTALL:
      return getStockConsoleProvider().createAndAttach(parent, handler, executor);
  }
  throw new AssertionError();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:15,代码来源:AndroidTestConsoleProvider.java

示例11: processConsole

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
private static void processConsole(Project project, ProcessHandler processHandler) {
        ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
        consoleView.clear();
        consoleView.attachToProcess(processHandler);
        processHandler.startNotify();

        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
        ToolWindow toolWindow;
        toolWindow = toolWindowManager.getToolWindow(TOOL_ID);

        // if already exist tool window then show it
        if (toolWindow != null) {
            toolWindow.show(null);// TODO add more tabs here?
            return;
        }

        toolWindow = toolWindowManager.registerToolWindow(TOOL_ID, true, ToolWindowAnchor.BOTTOM);
        toolWindow.setTitle("Android....");
        toolWindow.setStripeTitle("Android Console");
        toolWindow.setShowStripeButton(true);
        toolWindow.setIcon(PluginIcons.ICON_TOOL_WINDOW);

        JPanel panel = new JPanel((LayoutManager) new BorderLayout());
        panel.add((Component) consoleView.getComponent(), "Center");

        // Create toolbars
        DefaultActionGroup toolbarActions = new DefaultActionGroup();
        AnAction[]
                consoleActions = consoleView.createConsoleActions();// 必须在 consoleView.getComponent() 调用后组件真正初始化之后调用
        toolbarActions.addAll((AnAction[]) Arrays.copyOf(consoleActions, consoleActions.length));
        toolbarActions.add((AnAction) new StopProcessAction("Stop process", "Stop process", processHandler));
//        toolbarActions.add((AnAction) new CloseAction(defaultExecutor, runDescriptor, project));


        ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("unknown", (ActionGroup) toolbarActions, false);
        toolbar.setTargetComponent(consoleView.getComponent());
        panel.add((Component) toolbar.getComponent(), "West");

        ContentImpl consoleContent = new ContentImpl(panel, "Build", false);
        consoleContent.setManager(toolWindow.getContentManager());

        toolbarActions.add(new CloseTabAction(consoleContent));

//        addAdditionalConsoleEditorActions(consoleView, consoleContent);
//        consoleComponent.setActions();
        toolWindow.getContentManager().addContent(consoleContent);
        toolWindow.getContentManager().addContent(new ContentImpl(new JButton("Test"), "Build2", false));
        toolWindow.show(null);
    }
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:50,代码来源:RNUtil.java

示例12: toNativeState

import com.intellij.execution.ui.ConsoleView; //导入方法依赖的package包/类
PythonScriptCommandLineState toNativeState(ExecutionEnvironment env) throws ExecutionException {
  File executable = env.getCopyableUserData(EXECUTABLE_KEY).get();
  if (executable == null || StringUtil.isEmptyOrSpaces(executable.getPath())) {
    throw new ExecutionException("No blaze output script found");
  }
  PythonRunConfiguration nativeConfig =
      (PythonRunConfiguration)
          PythonConfigurationType.getInstance()
              .getFactory()
              .createTemplateConfiguration(env.getProject());
  nativeConfig.setScriptName(executable.getPath());
  nativeConfig.setAddContentRoots(false);
  nativeConfig.setAddSourceRoots(false);
  nativeConfig.setWorkingDirectory(
      Strings.nullToEmpty(
          getRunfilesPath(executable, WorkspaceRoot.fromProjectSafe(env.getProject()))));

  Sdk sdk = PySdkUtils.getPythonSdk(env.getProject());
  if (sdk == null) {
    throw new ExecutionException("Can't find a Python SDK when debugging a python target.");
  }
  nativeConfig.setModule(null);
  nativeConfig.setSdkHome(sdk.getHomePath());

  BlazePyRunConfigState handlerState =
      configuration.getHandlerStateIfType(BlazePyRunConfigState.class);
  if (handlerState != null) {
    nativeConfig.setScriptParameters(Strings.emptyToNull(getScriptParams(handlerState)));

    EnvironmentVariablesData envState = handlerState.getEnvVarsState().getData();
    nativeConfig.setPassParentEnvs(envState.isPassParentEnvs());
    nativeConfig.setEnvs(envState.getEnvs());
  }
  return new PythonScriptCommandLineState(nativeConfig, env) {
    @Override
    public boolean isDebug() {
      return true;
    }

    @Override
    protected ConsoleView createAndAttachConsole(
        Project project, ProcessHandler processHandler, Executor executor)
        throws ExecutionException {
      ConsoleView consoleView = createConsoleBuilder(project, getSdk()).getConsole();
      consoleView.addMessageFilter(createUrlFilter(processHandler));

      consoleView.attachToProcess(processHandler);
      return consoleView;
    }

    @Override
    protected ProcessHandler doCreateProcess(GeneralCommandLine commandLine)
        throws ExecutionException {
      ProcessHandler handler = super.doCreateProcess(commandLine);
      if (handler instanceof KillableProcessHandler) {
        // SIGINT can cause the JVM to crash, when stopped at a breakpoint (IDEA-167432).
        ((KillableProcessHandler) handler).setShouldKillProcessSoftly(false);
      }
      return handler;
    }
  };
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:63,代码来源:BlazePyRunConfigurationRunner.java


注:本文中的com.intellij.execution.ui.ConsoleView.attachToProcess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。