本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
});
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
}