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


Java ProcessTerminatedListener类代码示例

本文整理汇总了Java中com.intellij.execution.process.ProcessTerminatedListener的典型用法代码示例。如果您正苦于以下问题:Java ProcessTerminatedListener类的具体用法?Java ProcessTerminatedListener怎么用?Java ProcessTerminatedListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: showHelperProcessRunContent

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
public static final ConsoleView showHelperProcessRunContent(String header, OSProcessHandler runHandler, Project project, Executor defaultExecutor) {
        ProcessTerminatedListener.attach(runHandler);

        ConsoleViewImpl consoleView = new ConsoleViewImpl(project, true);
        DefaultActionGroup toolbarActions = new DefaultActionGroup();

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

        RunContentDescriptor runDescriptor = new RunContentDescriptor((ExecutionConsole) consoleView,
                (ProcessHandler) runHandler, (JComponent) panel, header, AllIcons.RunConfigurations.Application);
        AnAction[]
                consoleActions = consoleView.createConsoleActions();
        toolbarActions.addAll((AnAction[]) Arrays.copyOf(consoleActions, consoleActions.length));
        toolbarActions.add((AnAction) new StopProcessAction("Stop process", "Stop process", (ProcessHandler) runHandler));
        toolbarActions.add((AnAction) new CloseAction(defaultExecutor, runDescriptor, project));

        consoleView.attachToProcess((ProcessHandler) runHandler);
//        ExecutionManager.getInstance(environment.getProject()).getContentManager().showRunContent(environment.getExecutor(), runDescriptor);
        showConsole(project, defaultExecutor, runDescriptor);
        return (ConsoleView) consoleView;
    }
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:26,代码来源:RunnerUtil.java

示例2: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@NotNull
protected OSProcessHandler startProcess() throws ExecutionException {
  final OSProcessHandler handler = JavaCommandLineStateUtil.startProcess(createCommandLine());
  ProcessTerminatedListener.attach(handler, myProject, JavadocBundle.message("javadoc.generate.exited"));
  handler.addProcessListener(new ProcessAdapter() {
    public void processTerminated(ProcessEvent event) {
      if (myConfiguration.OPEN_IN_BROWSER) {
        File url = new File(myConfiguration.OUTPUT_DIRECTORY, INDEX_HTML);
        if (url.exists() && event.getExitCode() == 0) {
          BrowserUtil.browse(url);
        }
      }
    }
  });
  return handler;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavadocGeneratorRunProfile.java

示例3: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
/**
 * Patches the command line parameters applying patchers from first to last, and then runs it.
 *
 * @param patchers any number of patchers; any patcher may be null, and the whole argument may be null.
 * @return handler of the started process
 * @throws ExecutionException
 */
protected ProcessHandler startProcess(CommandLinePatcher... patchers) throws ExecutionException {
  GeneralCommandLine commandLine = generateCommandLine(patchers);

  // Extend command line
  PythonRunConfigurationExtensionsManager.getInstance()
    .patchCommandLine(myConfig, getRunnerSettings(), commandLine, getEnvironment().getRunner().getRunnerId());
  Sdk sdk = PythonSdkType.findSdkByPath(myConfig.getInterpreterPath());
  final ProcessHandler processHandler;
  if (PySdkUtil.isRemote(sdk)) {
    PyRemotePathMapper pathMapper = createRemotePathMapper();
    processHandler = createRemoteProcessStarter().startRemoteProcess(sdk, commandLine, myConfig.getProject(), pathMapper);
  }
  else {
    EncodingEnvironmentUtil.setLocaleEnvironmentIfMac(commandLine);
    processHandler = doCreateProcess(commandLine);
    ProcessTerminatedListener.attach(processHandler);
  }

  // attach extensions
  PythonRunConfigurationExtensionsManager.getInstance().attachExtensionsToProcess(myConfig, processHandler, getRunnerSettings());

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

示例4: startRemoteProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
public ProcessHandler startRemoteProcess(@NotNull Sdk sdk,
                                         @NotNull GeneralCommandLine commandLine,
                                         @Nullable Project project,
                                         @Nullable PyRemotePathMapper pathMapper)
  throws ExecutionException {
  PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
  if (manager != null) {
    PyRemoteProcessHandlerBase processHandler;

    try {
      processHandler = doStartRemoteProcess(sdk, commandLine, manager, project, pathMapper);
    }
    catch (ExecutionException e) {
      final Application application = ApplicationManager.getApplication();
      if (application != null && (application.isUnitTestMode() || application.isHeadlessEnvironment())) {
        throw new RuntimeException(e);
      }
      throw new ExecutionException("Can't run remote python interpreter: " + e.getMessage(), e);
    }
    ProcessTerminatedListener.attach(processHandler);
    return processHandler;
  }
  else {
    throw new PythonRemoteInterpreterManager.PyRemoteInterpreterExecutionException();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PyRemoteProcessStarter.java

示例5: OCamlTopLevelConsoleView

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
public OCamlTopLevelConsoleView(@NotNull final Project project, @NotNull final ContentManager contentManager, final Sdk topLevelSdk) throws ExecutionException {
    super(project, contentManager);
    myConsoleNumber = ++ourLastConsoleNumber;

    final GeneralCommandLine cmd = createCommandLine(topLevelSdk);
    myConsoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
    myProcessHandler = new OSProcessHandler(cmd.createProcess(), cmd.getCommandLineString());
    myConsoleView.attachToProcess(myProcessHandler);
    ProcessTerminatedListener.attach(myProcessHandler);

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    final DefaultActionGroup group = new DefaultActionGroup();
    group.add(getOCamlToolWindowOpenCloseAction(true, false));
    group.addAll(myConsoleView.createConsoleActions());
    group.add(getOCamlToolWindowSettingsAction());
    group.add(getOCamlToolWindowOpenCloseAction(false, true));
    final JComponent toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false).getComponent();
    toolbar.setMaximumSize(new Dimension(toolbar.getPreferredSize().width, Integer.MAX_VALUE));

    add(toolbar);
    add(myConsoleView.getComponent());

    myConsoleView.getComponent().requestFocus();
    myProcessHandler.startNotify();
}
 
开发者ID:traff,项目名称:intellij-ocaml,代码行数:27,代码来源:OCamlTopLevelConsoleView.java

示例6: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@NotNull
@Override
protected ProcessHandler startProcess() throws ExecutionException {
  checkRunConfiguration();

  final String interpreterPath = TheRInterpreterService.getInstance().getInterpreterPath();

  if (StringUtil.isEmptyOrSpaces(interpreterPath)) {
    throw new ExecutionException("The R interpreter is not specified");
  }

  final ProcessHandler processHandler = startProcess(
    myRunConfiguration,
    TheRCommandLineCalculator.calculateCommandLine(
      interpreterPath,
      myRunConfiguration
    )
  );

  ProcessTerminatedListener.attach(processHandler, myRunConfiguration.getProject());

  return processHandler;
}
 
开发者ID:ktisha,项目名称:TheRPlugin,代码行数:24,代码来源:TheRCommandLineState.java

示例7: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@NotNull
protected OSProcessHandler startProcess() throws ExecutionException {
  final OSProcessHandler handler = JavaCommandLineStateUtil.startProcess(createCommandLine());
  ProcessTerminatedListener.attach(handler, myProject, JavadocBundle.message("javadoc.generate.exited"));
  handler.addProcessListener(new ProcessAdapter() {
    public void processTerminated(ProcessEvent event) {
      if (OPEN_IN_BROWSER) {
        File url = new File(OUTPUT_DIRECTORY, INDEX_HTML);
        if (url.exists() && event.getExitCode() == 0) {
          BrowserUtil.browse(url);
        }
      }
    }
  });
  return handler;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:JavadocConfiguration.java

示例8: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@NotNull
@Override
protected OSProcessHandler startProcess() throws ExecutionException
{
	OSProcessHandler handler;
	if(SystemInfo.isWindows)
	{
		handler = super.startProcess();
	}
	else
	{
		handler = KillableColoredProcessHandler.create(createCommandLine());
		ProcessTerminatedListener.attach(handler);
	}

	RunnerSettings runnerSettings = getRunnerSettings();
	JavaRunConfigurationExtensionManager.getInstance().attachExtensionsToProcess(getConfiguration(), handler, runnerSettings);
	return handler;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:20,代码来源:BaseJavaApplicationCommandLineState.java

示例9: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@NotNull
protected OSProcessHandler startProcess() throws ExecutionException
{
	final OSProcessHandler handler = JavaCommandLineStateUtil.startProcess(createCommandLine());
	ProcessTerminatedListener.attach(handler, myProject, JavadocBundle.message("javadoc.generate.exited"));
	handler.addProcessListener(new ProcessAdapter()
	{
		public void processTerminated(ProcessEvent event)
		{
			if(myConfiguration.OPEN_IN_BROWSER)
			{
				File url = new File(myConfiguration.OUTPUT_DIRECTORY, INDEX_HTML);
				if(url.exists() && event.getExitCode() == 0)
				{
					BrowserUtil.browse(url);
				}
			}
		}
	});
	return handler;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:JavadocGeneratorRunProfile.java

示例10: processCommandline

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
private static void processCommandline(final Project project, GeneralCommandLine commandLine) throws ExecutionException {
        final OSProcessHandler processHandler = new OSProcessHandler(commandLine);
        ProcessTerminatedListener.attach(processHandler);
//        processHandler.startNotify();// Don't call this, the command content will not be shown

        ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
                processConsole(project, processHandler);
            }
        });
    }
 
开发者ID:beansoftapp,项目名称:react-native-console,代码行数:13,代码来源:RNUtil.java

示例11: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@NotNull
@Override
protected ProcessHandler startProcess() throws ExecutionException {
    GeneralCommandLine commandLine = generateCommandLine();

    OSProcessHandler osProcessHandler =
            new LuaProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
    ProcessTerminatedListener.attach(osProcessHandler, runConfiguration.getProject());

    return osProcessHandler;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:12,代码来源:LuaCommandLineState.java

示例12: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@NotNull
@Override
protected OSProcessHandler startProcess() throws ExecutionException {
  OSProcessHandler handler = new KillableColoredProcessHandler(createCommandLine());
  ProcessTerminatedListener.attach(handler);
  JavaRunConfigurationExtensionManager.getInstance().attachExtensionsToProcess(getConfiguration(), handler, getRunnerSettings());
  return handler;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BaseJavaApplicationCommandLineState.java

示例13: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@NotNull
@Override
public ProcessHandler startProcess() throws ExecutionException {
    GeneralCommandLine cmd = new GeneralCommandLine();
    cmd.setExePath(config.getInterpreterName());
    cmd.getParametersList().addParametersString(config.getInterpreterOptions());

    cmd.addParameter(config.getProgramName());
    cmd.getParametersList().addParametersString(config.getProgramParameters());

    OSProcessHandler processHandler = new KillableColoredProcessHandler(cmd);
    ProcessTerminatedListener.attach(processHandler, getEnvironment().getProject());

    return processHandler;
}
 
开发者ID:d0as8,项目名称:PerlRun,代码行数:16,代码来源:RunState.java

示例14: startProcess

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@Override
@NotNull
protected OSProcessHandler startProcess() throws ExecutionException {
    final GeneralCommandLine cmd = generateCommandLine();
    final OSProcessHandler processHandler = new OSProcessHandler(cmd.createProcess(), cmd.getCommandLineString());
    ProcessTerminatedListener.attach(processHandler);
    return processHandler;
}
 
开发者ID:traff,项目名称:intellij-ocaml,代码行数:9,代码来源:OCamlCommandLineState.java

示例15: run

import com.intellij.execution.process.ProcessTerminatedListener; //导入依赖的package包/类
@RequiredDispatchThread
public static void run(@NotNull Project project, VirtualFile packageFile, @NotNull String action)
{
	NodeJSModuleExtension extension = ModuleUtilCore.getExtension(project, packageFile, NodeJSModuleExtension.class);
	if(extension == null)
	{
		return;
	}

	Sdk sdk = extension.getSdk();
	if(sdk == null)
	{
		Messages.showErrorDialog(project, "NodeJS bundle is undefined", "Error");
		return;
	}

	File npmExecutable = getNpmExecutable(sdk.getHomePath());
	if(!npmExecutable.exists())
	{
		Messages.showErrorDialog(project, "'npm' executable is not found", "Error");
		return;
	}
	GeneralCommandLine commandLine = new GeneralCommandLine();
	commandLine.setExePath(npmExecutable.getPath());
	commandLine.addParameter(action);
	commandLine.setWorkDirectory(packageFile.getParent().getPath());

	final RunContentExecutor contentExecutor;
	try
	{
		OSProcessHandler process = new OSProcessHandler(commandLine);
		ProcessTerminatedListener.attach(process);
		contentExecutor = new RunContentExecutor(project, process).withTitle("npm " + action).withActivateToolWindow(false);
		contentExecutor.run();
	}
	catch(ExecutionException e)
	{
		Messages.showErrorDialog(project, "Fail to run npm manager: " + e.getMessage(), "Error");
	}
}
 
开发者ID:consulo,项目名称:consulo-nodejs,代码行数:41,代码来源:NpmRunUtil.java


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