Search in sources :

Example 1 with RunContentManager

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

the class ExecutionHelper method descriptorToFront.

private static void descriptorToFront(@NotNull final Project project, @NotNull final RunContentDescriptor descriptor) {
    ApplicationManager.getApplication().invokeLater(() -> {
        RunContentManager manager = ExecutionManager.getInstance(project).getContentManager();
        ToolWindow toolWindow = manager.getToolWindowByDescriptor(descriptor);
        if (toolWindow != null) {
            toolWindow.show(null);
            manager.selectRunContent(descriptor);
        }
    }, project.getDisposed());
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) RunContentManager(com.intellij.execution.ui.RunContentManager)

Example 2 with RunContentManager

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

the class ExecutionHelper method findRunningConsole.

public static Collection<RunContentDescriptor> findRunningConsole(@NotNull Project project, @NotNull NotNullFunction<RunContentDescriptor, Boolean> descriptorMatcher) {
    RunContentManager contentManager = ExecutionManager.getInstance(project).getContentManager();
    final RunContentDescriptor selectedContent = contentManager.getSelectedContent();
    if (selectedContent != null) {
        final ToolWindow toolWindow = contentManager.getToolWindowByDescriptor(selectedContent);
        if (toolWindow != null && toolWindow.isVisible()) {
            if (descriptorMatcher.fun(selectedContent)) {
                return Collections.singletonList(selectedContent);
            }
        }
    }
    final ArrayList<RunContentDescriptor> result = ContainerUtil.newArrayList();
    for (RunContentDescriptor runContentDescriptor : contentManager.getAllDescriptors()) {
        if (descriptorMatcher.fun(runContentDescriptor)) {
            result.add(runContentDescriptor);
        }
    }
    return result;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) RunContentManager(com.intellij.execution.ui.RunContentManager)

Example 3 with RunContentManager

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

the class XDebugSessionTab method toFront.

public void toFront(boolean focus, @Nullable final Runnable onShowCallback) {
    if (ApplicationManager.getApplication().isUnitTestMode())
        return;
    ApplicationManager.getApplication().invokeLater(() -> {
        if (myRunContentDescriptor != null) {
            RunContentManager manager = ExecutionManager.getInstance(myProject).getContentManager();
            ToolWindow toolWindow = manager.getToolWindowByDescriptor(myRunContentDescriptor);
            if (toolWindow != null) {
                if (!toolWindow.isVisible()) {
                    toolWindow.show(() -> {
                        if (onShowCallback != null) {
                            onShowCallback.run();
                        }
                        myRebuildWatchesRunnable.run();
                    });
                }
                manager.selectRunContent(myRunContentDescriptor);
            }
        }
    });
    if (focus) {
        ApplicationManager.getApplication().invokeLater(() -> {
            boolean focusWnd = Registry.is("debugger.mayBringFrameToFrontOnBreakpoint");
            ProjectUtil.focusProjectWindow(myProject, focusWnd);
            if (!focusWnd) {
                AppIcon.getInstance().requestAttention(myProject, true);
            }
        });
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) RunContentManager(com.intellij.execution.ui.RunContentManager)

Example 4 with RunContentManager

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

the class DebuggerSessionTabBase method select.

public void select() {
    if (ApplicationManager.getApplication().isUnitTestMode())
        return;
    UIUtil.invokeLaterIfNeeded(() -> {
        if (myRunContentDescriptor != null) {
            RunContentManager manager = ExecutionManager.getInstance(myProject).getContentManager();
            ToolWindow toolWindow = manager.getToolWindowByDescriptor(myRunContentDescriptor);
            Content content = myRunContentDescriptor.getAttachedContent();
            if (toolWindow == null || content == null)
                return;
            manager.selectRunContent(myRunContentDescriptor);
        }
    });
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) RunContentManager(com.intellij.execution.ui.RunContentManager)

Example 5 with RunContentManager

use of com.intellij.execution.ui.RunContentManager 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)

Aggregations

RunContentManager (com.intellij.execution.ui.RunContentManager)5 ToolWindow (com.intellij.openapi.wm.ToolWindow)4 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)2 Content (com.intellij.ui.content.Content)1