Search in sources :

Example 41 with RunContentDescriptor

use of com.intellij.execution.ui.RunContentDescriptor in project intellij-plugins by JetBrains.

the class FlexUnitTestRunner method execute.

@Override
public void execute(@NotNull final ExecutionEnvironment env, @Nullable final Callback callback) throws ExecutionException {
    final Project project = env.getProject();
    final RunProfileState state = env.getState();
    if (state == null) {
        return;
    }
    Runnable startRunnable = () -> {
        try {
            if (project.isDisposed())
                return;
            final RunContentDescriptor descriptor = doExecute(state, env);
            if (callback != null)
                callback.processStarted(descriptor);
            if (descriptor != null) {
                ExecutionManager.getInstance(project).getContentManager().showRunContent(env.getExecutor(), descriptor);
                final ProcessHandler processHandler = descriptor.getProcessHandler();
                if (processHandler != null)
                    processHandler.startNotify();
            }
        } catch (ExecutionException e) {
            ExecutionUtil.handleExecutionError(env, e);
        }
    };
    ExecutionManager.getInstance(project).compileAndRun(startRunnable, env, state, null);
}
Also used : Project(com.intellij.openapi.project.Project) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) RunProfileState(com.intellij.execution.configurations.RunProfileState) ProcessHandler(com.intellij.execution.process.ProcessHandler) ExecutionException(com.intellij.execution.ExecutionException)

Example 42 with RunContentDescriptor

use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.

the class XDebuggerManagerImpl method removeSession.

public void removeSession(@NotNull final XDebugSessionImpl session) {
    XDebugSessionTab sessionTab = session.getSessionTab();
    mySessions.remove(session.getDebugProcess().getProcessHandler());
    if (sessionTab != null) {
        RunContentDescriptor descriptor = sessionTab.getRunContentDescriptor();
        if (descriptor != null) {
            // in test-mode RunContentWithExecutorListener.contentRemoved events are not sent (see RunContentManagerImpl.showRunContent)
            // so we make sure the mySessions and mySessionData are cleared correctly when session is disposed
            Disposer.register(descriptor, () -> mySessions.remove(session.getDebugProcess().getProcessHandler()));
        }
        if (!myProject.isDisposed() && !ApplicationManager.getApplication().isUnitTestMode() && XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isHideDebuggerOnProcessTermination()) {
            ExecutionManager.getInstance(myProject).getContentManager().hideRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
        }
    }
    if (myActiveSession.compareAndSet(session, null)) {
        onActiveSessionChanged();
    }
}
Also used : XDebugSessionTab(com.intellij.xdebugger.impl.ui.XDebugSessionTab) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor)

Example 43 with RunContentDescriptor

use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.

the class XDebugSessionTab method setSession.

private void setSession(@NotNull XDebugSessionImpl session, @Nullable ExecutionEnvironment environment, @Nullable Icon icon) {
    myEnvironment = environment;
    mySession = session;
    mySessionData = session.getSessionData();
    myConsole = session.getConsoleView();
    AnAction[] restartActions;
    List<AnAction> restartActionsList = session.getRestartActions();
    if (ContainerUtil.isEmpty(restartActionsList)) {
        restartActions = AnAction.EMPTY_ARRAY;
    } else {
        restartActions = restartActionsList.toArray(new AnAction[restartActionsList.size()]);
    }
    myRunContentDescriptor = new RunContentDescriptor(myConsole, session.getDebugProcess().getProcessHandler(), myUi.getComponent(), session.getSessionName(), icon, myRebuildWatchesRunnable, restartActions);
    Disposer.register(myRunContentDescriptor, this);
    Disposer.register(myProject, myRunContentDescriptor);
}
Also used : RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor)

Example 44 with RunContentDescriptor

use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.

the class FakeRerunAction method getEnvironment.

@Nullable
protected ExecutionEnvironment getEnvironment(@NotNull AnActionEvent event) {
    ExecutionEnvironment environment = event.getData(LangDataKeys.EXECUTION_ENVIRONMENT);
    if (environment == null) {
        Project project = event.getProject();
        RunContentDescriptor contentDescriptor = project == null ? null : ExecutionManager.getInstance(project).getContentManager().getSelectedContent();
        if (contentDescriptor != null) {
            JComponent component = contentDescriptor.getComponent();
            if (component != null) {
                environment = LangDataKeys.EXECUTION_ENVIRONMENT.getData(DataManager.getInstance().getDataContext(component));
            }
        }
    }
    return environment;
}
Also used : Project(com.intellij.openapi.project.Project) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) Nullable(org.jetbrains.annotations.Nullable)

Example 45 with RunContentDescriptor

use of com.intellij.execution.ui.RunContentDescriptor in project intellij-community by JetBrains.

the class FakeRerunAction method isEnabled.

protected boolean isEnabled(AnActionEvent event) {
    RunContentDescriptor descriptor = getDescriptor(event);
    ProcessHandler processHandler = descriptor == null ? null : descriptor.getProcessHandler();
    ExecutionEnvironment environment = getEnvironment(event);
    return environment != null && !ExecutorRegistry.getInstance().isStarting(environment) && !(processHandler != null && processHandler.isProcessTerminating());
}
Also used : RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) ProcessHandler(com.intellij.execution.process.ProcessHandler)

Aggregations

RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)70 ProcessHandler (com.intellij.execution.process.ProcessHandler)26 Project (com.intellij.openapi.project.Project)18 NotNull (org.jetbrains.annotations.NotNull)14 Nullable (org.jetbrains.annotations.Nullable)13 ExecutionEnvironment (com.intellij.execution.runners.ExecutionEnvironment)11 Executor (com.intellij.execution.Executor)10 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)9 ProcessEvent (com.intellij.execution.process.ProcessEvent)8 ExecutionException (com.intellij.execution.ExecutionException)7 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)7 ArrayList (java.util.ArrayList)7 ProgramRunner (com.intellij.execution.runners.ProgramRunner)6 ExecutionResult (com.intellij.execution.ExecutionResult)5 RunProfile (com.intellij.execution.configurations.RunProfile)5 CloseAction (com.intellij.execution.ui.actions.CloseAction)5 Pair (com.intellij.openapi.util.Pair)5 IOException (java.io.IOException)5 RunContentManager (com.intellij.execution.ui.RunContentManager)4 ApplicationManager (com.intellij.openapi.application.ApplicationManager)4