Search in sources :

Example 71 with ProcessEvent

use of com.intellij.execution.process.ProcessEvent in project intellij-plugins by JetBrains.

the class KarmaProcessOutputManager method startNotify.

public void startNotify() {
    myProcessHandler.addProcessListener(new ProcessAdapter() {

        @Override
        public void onTextAvailable(ProcessEvent event, Key outputType) {
            String text = event.getText();
            if (outputType != ProcessOutputTypes.SYSTEM && outputType != ProcessOutputTypes.STDERR) {
                processStandardOutput(text, outputType);
            } else {
                addText(text, outputType);
            }
        }
    });
    myProcessHandler.startNotify();
}
Also used : ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ProcessEvent(com.intellij.execution.process.ProcessEvent) Key(com.intellij.openapi.util.Key)

Example 72 with ProcessEvent

use of com.intellij.execution.process.ProcessEvent in project intellij-plugins by JetBrains.

the class BndTestState method startProcess.

@NotNull
@Override
protected OSProcessHandler startProcess() throws ExecutionException {
    OSProcessHandler processHandler = super.startProcess();
    processHandler.addProcessListener(new ProcessAdapter() {

        @Override
        public void processTerminated(ProcessEvent event) {
            cleanup();
        }
    });
    return processHandler;
}
Also used : ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ProcessEvent(com.intellij.execution.process.ProcessEvent) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) NotNull(org.jetbrains.annotations.NotNull)

Example 73 with ProcessEvent

use of com.intellij.execution.process.ProcessEvent in project intellij-plugins by JetBrains.

the class BndLaunchState method startProcess.

@NotNull
@Override
protected OSProcessHandler startProcess() throws ExecutionException {
    OSProcessHandler handler = super.startProcess();
    MessageBusConnection connection = myProject.getMessageBus().connect();
    connection.subscribe(CompilerTopics.COMPILATION_STATUS, this);
    HotSwapUI hotSwapManager = HotSwapUI.getInstance(myProject);
    hotSwapManager.addListener(this);
    handler.addProcessListener(new ProcessAdapter() {

        @Override
        public void processTerminated(ProcessEvent event) {
            connection.disconnect();
            hotSwapManager.removeListener(BndLaunchState.this);
            myLauncher.cleanup();
        }
    });
    return handler;
}
Also used : MessageBusConnection(com.intellij.util.messages.MessageBusConnection) ProcessAdapter(com.intellij.execution.process.ProcessAdapter) HotSwapUI(com.intellij.debugger.ui.HotSwapUI) ProcessEvent(com.intellij.execution.process.ProcessEvent) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) NotNull(org.jetbrains.annotations.NotNull)

Example 74 with ProcessEvent

use of com.intellij.execution.process.ProcessEvent in project intellij-plugins by JetBrains.

the class SocketProcessHandler method startNotify.

@Override
public void startNotify() {
    notifyTextAvailable(myCommandLine + '\n', ProcessOutputTypes.SYSTEM);
    addProcessListener(new ProcessAdapter() {

        @Override
        public void startNotified(final ProcessEvent event) {
            try {
                myOutputReader = new SocketOutputReader(mySocket.getInputStream());
            } catch (Exception e) {
            //pass
            } finally {
                removeProcessListener(this);
            }
        }
    });
    super.startNotify();
}
Also used : ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ProcessEvent(com.intellij.execution.process.ProcessEvent)

Example 75 with ProcessEvent

use of com.intellij.execution.process.ProcessEvent in project intellij-plugins by JetBrains.

the class RubyMotionUtilImpl method generateApp.

public void generateApp(final VirtualFile dir, final Module module, Sdk sdk, final ProjectType projectType) {
    final Project project = module.getProject();
    final String applicationHomePath = dir.getPath();
    final File tempDirectory;
    try {
        tempDirectory = FileUtil.createTempDirectory("RubyMotion", ".RubyMine");
    } catch (IOException e) {
        throw new Error(e);
    }
    final File generatedApp = new File(tempDirectory, module.getName());
    final Filter[] filters = null;
    final ProcessAdapter processListener = new ProcessAdapter() {

        public void processTerminated(ProcessEvent event) {
            FileUtil.moveDirWithContent(generatedApp, VfsUtilCore.virtualToIoFile(dir));
            tempDirectory.delete();
            if (module.isDisposed()) {
                return;
            }
            RModuleUtil.getInstance().refreshRubyModuleTypeContent(module);
            GeneratorsUtil.openFileInEditor(project, "app/app_delegate.rb", applicationHomePath);
            GeneratorsUtil.openFileInEditor(project, RakeUtilBase.RAKE_FILE, applicationHomePath);
            GeneratorsUtil.openFileInEditor(project, BundlerUtil.GEMFILE, applicationHomePath);
        }
    };
    final MergingCommandLineArgumentsProvider resultProvider = new MergingCommandLineArgumentsProvider(new String[] { getRubyMotionPath() + "/bin/motion", "create", "--template=" + projectType.name().toLowerCase(Locale.US), module.getName() }, null, null, null, sdk);
    ConsoleRunner.run(module, null, processListener, filters, null, ConsoleRunner.ProcessLaunchMode.BACKGROUND_TASK_WITH_PROGRESS, "Generating RubyMotion Application '" + module.getName() + "'...", tempDirectory.getAbsolutePath(), resultProvider, null, false);
}
Also used : Project(com.intellij.openapi.project.Project) MergingCommandLineArgumentsProvider(org.jetbrains.plugins.ruby.ruby.run.MergingCommandLineArgumentsProvider) ProcessAdapter(com.intellij.execution.process.ProcessAdapter) Filter(com.intellij.execution.filters.Filter) ProcessEvent(com.intellij.execution.process.ProcessEvent) IOException(java.io.IOException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) RFile(org.jetbrains.plugins.ruby.ruby.lang.psi.RFile) PsiFile(com.intellij.psi.PsiFile) File(java.io.File)

Aggregations

ProcessEvent (com.intellij.execution.process.ProcessEvent)90 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)82 Key (com.intellij.openapi.util.Key)34 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)25 NotNull (org.jetbrains.annotations.NotNull)24 ExecutionException (com.intellij.execution.ExecutionException)22 ProcessHandler (com.intellij.execution.process.ProcessHandler)18 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)16 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)12 IOException (java.io.IOException)12 Nullable (org.jetbrains.annotations.Nullable)12 Project (com.intellij.openapi.project.Project)9 File (java.io.File)9 ProcessListener (com.intellij.execution.process.ProcessListener)8 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)7 ExecutionEnvironmentBuilder (com.intellij.execution.runners.ExecutionEnvironmentBuilder)5 ProgramRunner (com.intellij.execution.runners.ProgramRunner)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)4 Disposable (com.intellij.openapi.Disposable)4