Search in sources :

Example 61 with RunContentDescriptor

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

the class AbstractAutoTestManager method restartAllAutoTests.

protected void restartAllAutoTests(int modificationStamp) {
    RunContentManager contentManager = ExecutionManager.getInstance(myProject).getContentManager();
    boolean active = false;
    for (RunContentDescriptor descriptor : contentManager.getAllDescriptors()) {
        if (isAutoTestEnabledForDescriptor(descriptor)) {
            restartAutoTest(descriptor, modificationStamp, myWatcher);
            active = true;
        }
    }
    if (!active) {
        myWatcher.deactivate();
    }
}
Also used : RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) RunContentManager(com.intellij.execution.ui.RunContentManager)

Example 62 with RunContentDescriptor

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

the class AdjustAutotestDelayActionGroup method update.

@Override
public void update(AnActionEvent e) {
    RunContentDescriptor descriptor = LangDataKeys.RUN_CONTENT_DESCRIPTOR.getData(myDataContext);
    boolean visible = false;
    if (descriptor != null) {
        for (AnAction action : descriptor.getRestartActions()) {
            if (action instanceof ToggleAutoTestAction) {
                visible = ((ToggleAutoTestAction) action).isDelayApplicable();
                break;
            }
        }
    }
    e.getPresentation().setVisible(visible);
}
Also used : RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor)

Example 63 with RunContentDescriptor

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

the class ToggleAutoTestAction method isSelected.

@Override
public boolean isSelected(AnActionEvent e) {
    Project project = e.getProject();
    RunContentDescriptor descriptor = e.getData(LangDataKeys.RUN_CONTENT_DESCRIPTOR);
    return project != null && descriptor != null && getAutoTestManager(project).isAutoTestEnabled(descriptor);
}
Also used : Project(com.intellij.openapi.project.Project) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor)

Example 64 with RunContentDescriptor

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

the class RerunFailedTestsAction method getAction.

private static boolean getAction(@NotNull AnActionEvent e, boolean execute) {
    Project project = e.getProject();
    if (project == null) {
        return false;
    }
    RunContentDescriptor contentDescriptor = ExecutionManager.getInstance(project).getContentManager().getSelectedContent();
    if (contentDescriptor == null) {
        return false;
    }
    JComponent component = contentDescriptor.getComponent();
    if (component == null) {
        return false;
    }
    ExecutionEnvironment environment = LangDataKeys.EXECUTION_ENVIRONMENT.getData(DataManager.getInstance().getDataContext(component));
    if (environment == null) {
        return false;
    }
    AnAction[] actions = contentDescriptor.getRestartActions();
    if (actions.length == 0) {
        return false;
    }
    for (AnAction action : actions) {
        if (action instanceof AbstractRerunFailedTestsAction) {
            if (execute) {
                ((AbstractRerunFailedTestsAction) action).execute(e, environment);
            }
            return true;
        }
    }
    return false;
}
Also used : Project(com.intellij.openapi.project.Project) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 65 with RunContentDescriptor

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

the class AbstractTerminalRunner method initConsoleUI.

private void initConsoleUI(final T process) {
    final Executor defaultExecutor = DefaultRunExecutor.getRunExecutorInstance();
    final DefaultActionGroup toolbarActions = new DefaultActionGroup();
    final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(actionToolbar.getComponent(), BorderLayout.WEST);
    actionToolbar.setTargetComponent(panel);
    ProcessHandler processHandler = createProcessHandler(process);
    final RunContentDescriptor contentDescriptor = new RunContentDescriptor(null, processHandler, panel, getTerminalConnectionName(process));
    contentDescriptor.setAutoFocusContent(true);
    toolbarActions.add(createCloseAction(defaultExecutor, contentDescriptor));
    final JBTerminalSystemSettingsProvider provider = new JBTerminalSystemSettingsProvider();
    TerminalWidget widget = new JBTabbedTerminalWidget(myProject, provider, new Predicate<Pair<TerminalWidget, String>>() {

        @Override
        public boolean apply(Pair<TerminalWidget, String> widget) {
            openSessionInDirectory(widget.getFirst(), widget.getSecond());
            return true;
        }
    }, contentDescriptor);
    createAndStartSession(widget, createTtyConnector(process));
    panel.add(widget.getComponent(), BorderLayout.CENTER);
    showConsole(defaultExecutor, contentDescriptor, widget.getComponent());
    processHandler.startNotify();
}
Also used : RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) DefaultRunExecutor(com.intellij.execution.executors.DefaultRunExecutor) Executor(com.intellij.execution.Executor) ProcessHandler(com.intellij.execution.process.ProcessHandler) TerminalWidget(com.jediterm.terminal.ui.TerminalWidget) Pair(com.intellij.openapi.util.Pair)

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