Search in sources :

Example 1 with JBRunnerTabs

use of com.intellij.execution.ui.layout.impl.JBRunnerTabs in project android by JetBrains.

the class AndroidToolWindowFixture method selectTab.

private void selectTab(@NotNull final String tabName) {
    JBRunnerTabs tabs = myRobot.finder().findByType(getContentPanel(), JBRunnerTabs.class);
    TabLabel tabLabel = myRobot.finder().find(tabs, new GenericTypeMatcher<TabLabel>(TabLabel.class) {

        @Override
        protected boolean isMatching(@NotNull TabLabel component) {
            return tabName.equals(component.toString()) && component.getParent() == tabs;
        }
    });
    myRobot.click(tabLabel);
}
Also used : JBRunnerTabs(com.intellij.execution.ui.layout.impl.JBRunnerTabs) TabLabel(com.intellij.ui.tabs.impl.TabLabel)

Example 2 with JBRunnerTabs

use of com.intellij.execution.ui.layout.impl.JBRunnerTabs in project flutter-intellij by flutter.

the class ObservatoryActionGroup method addInspector.

private void addInspector(FlutterApp app, @Nullable InspectorService inspectorService, ToolWindow toolWindow) {
    final ContentManager contentManager = toolWindow.getContentManager();
    final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(true);
    final JBRunnerTabs runnerTabs = new JBRunnerTabs(myProject, ActionManager.getInstance(), null, this);
    final List<FlutterDevice> existingDevices = new ArrayList<>();
    for (FlutterApp otherApp : perAppViewState.keySet()) {
        existingDevices.add(otherApp.device());
    }
    final JPanel tabContainer = new JPanel(new BorderLayout());
    final Content content = contentManager.getFactory().createContent(null, app.device().getUniqueName(existingDevices), false);
    tabContainer.add(runnerTabs.getComponent(), BorderLayout.CENTER);
    content.setComponent(tabContainer);
    content.putUserData(ToolWindow.SHOW_CONTENT_ICON, Boolean.TRUE);
    content.setIcon(FlutterIcons.Phone);
    contentManager.addContent(content);
    final PerAppState state = getOrCreateStateForApp(app);
    assert (state.content == null);
    state.content = content;
    final DefaultActionGroup toolbarGroup = createToolbar(toolWindow, app, runnerTabs);
    toolWindowPanel.setToolbar(ActionManager.getInstance().createActionToolbar("FlutterViewToolbar", toolbarGroup, true).getComponent());
    // If the inspector is available (non-profile mode), then show it.
    if (inspectorService != null) {
        addInspectorPanel("Widgets", runnerTabs, state, InspectorService.FlutterTreeType.widget, app, inspectorService, toolWindow, toolbarGroup, true);
        addInspectorPanel("Render Tree", runnerTabs, state, InspectorService.FlutterTreeType.renderObject, app, inspectorService, toolWindow, toolbarGroup, false);
    } else {
        toolbarGroup.add(new OverflowAction(this, app));
        final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("InspectorToolbar", toolbarGroup, true);
        final JComponent toolbarComponent = toolbar.getComponent();
        toolbarComponent.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
        tabContainer.add(toolbarComponent, BorderLayout.NORTH);
        // Add a message about the inspector not being available in profile mode.
        final JBLabel label = new JBLabel("Widget info not available in profile mode", SwingConstants.CENTER);
        label.setForeground(UIUtil.getLabelDisabledForeground());
        tabContainer.add(label, BorderLayout.CENTER);
    }
    final boolean isVertical = !toolWindow.getAnchor().isHorizontal();
    if (isVertical) {
        final JPanel dashboardsPanel = new JPanel(new BorderLayout());
        tabContainer.add(dashboardsPanel, BorderLayout.SOUTH);
        if (FlutterSettings.getInstance().isShowHeapDisplay()) {
            dashboardsPanel.add(FPSDisplay.createJPanelView(runnerTabs, app), BorderLayout.NORTH);
            dashboardsPanel.add(HeapDisplay.createJPanelView(runnerTabs, app), BorderLayout.SOUTH);
        }
    }
}
Also used : FlutterApp(io.flutter.run.daemon.FlutterApp) ContentManager(com.intellij.ui.content.ContentManager) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel) FlutterDevice(io.flutter.run.daemon.FlutterDevice) JBRunnerTabs(com.intellij.execution.ui.layout.impl.JBRunnerTabs) JBLabel(com.intellij.ui.components.JBLabel) Content(com.intellij.ui.content.Content)

Aggregations

JBRunnerTabs (com.intellij.execution.ui.layout.impl.JBRunnerTabs)2 SimpleToolWindowPanel (com.intellij.openapi.ui.SimpleToolWindowPanel)1 JBLabel (com.intellij.ui.components.JBLabel)1 Content (com.intellij.ui.content.Content)1 ContentManager (com.intellij.ui.content.ContentManager)1 TabLabel (com.intellij.ui.tabs.impl.TabLabel)1 FlutterApp (io.flutter.run.daemon.FlutterApp)1 FlutterDevice (io.flutter.run.daemon.FlutterDevice)1