Search in sources :

Example 1 with TabInfo

use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.

the class PyDataView method updateTabs.

public void updateTabs(@NotNull ProcessHandler handler) {
    saveSelectedInfo();
    for (TabInfo info : myTabs.getTabs()) {
        PyDataViewerPanel panel = getPanel(info);
        PyFrameAccessor accessor = panel.getFrameAccessor();
        if (!(accessor instanceof PyDebugProcess)) {
            continue;
        }
        boolean shouldBeShown = Comparing.equal(handler, ((PyDebugProcess) accessor).getProcessHandler());
        info.setHidden(!shouldBeShown);
    }
    restoreSelectedInfo(handler);
    if (myTabs.getSelectedInfo() == null) {
        PyFrameAccessor accessor = getFrameAccessor(handler);
        if (accessor != null) {
            addTab(accessor);
        }
    }
}
Also used : PyFrameAccessor(com.jetbrains.python.debugger.PyFrameAccessor) TabInfo(com.intellij.ui.tabs.TabInfo) PyDebugProcess(com.jetbrains.python.debugger.PyDebugProcess)

Example 2 with TabInfo

use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.

the class PyDataView method addTab.

private TabInfo addTab(@NotNull PyFrameAccessor frameAccessor) {
    if (hasOnlyEmptyTab()) {
        myTabs.removeTab(myTabs.getSelectedInfo());
    }
    PyDataViewerPanel panel = new PyDataViewerPanel(myProject, frameAccessor);
    TabInfo info = new TabInfo(panel);
    if (frameAccessor instanceof PydevConsoleCommunication) {
        info.setIcon(PythonIcons.Python.PythonConsole);
        info.setTooltipText("Connected to Python Console");
    }
    if (frameAccessor instanceof PyDebugProcess) {
        info.setIcon(AllIcons.Toolwindows.ToolWindowDebugger);
        String name = ((PyDebugProcess) frameAccessor).getSession().getSessionName();
        info.setTooltipText("Connected to debug session '" + name + "'");
    }
    info.setText(EMPTY_TAB_NAME);
    info.setPreferredFocusableComponent(panel.getSliceTextField());
    info.setActions(new DefaultActionGroup(new NewViewerAction(frameAccessor)), ActionPlaces.UNKNOWN);
    info.setTabLabelActions(new DefaultActionGroup(new CloseViewerAction(info, frameAccessor)), ActionPlaces.UNKNOWN);
    panel.addListener(name -> info.setText(name));
    myTabs.addTab(info);
    myTabs.select(info, true);
    return info;
}
Also used : PydevConsoleCommunication(com.jetbrains.python.console.PydevConsoleCommunication) TabInfo(com.intellij.ui.tabs.TabInfo) PyDebugProcess(com.jetbrains.python.debugger.PyDebugProcess)

Example 3 with TabInfo

use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.

the class PyDataView method restoreSelectedInfo.

private void restoreSelectedInfo(@NotNull ProcessHandler handler) {
    TabInfo savedSelection = mySelectedInfos.get(handler);
    if (savedSelection != null) {
        myTabs.select(savedSelection, true);
        mySelectedInfos.remove(handler);
    }
}
Also used : TabInfo(com.intellij.ui.tabs.TabInfo)

Example 4 with TabInfo

use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.

the class GridCellImpl method createTabInfoFor.

private TabInfo createTabInfoFor(Content content) {
    final TabInfo tabInfo = updatePresentation(new TabInfo(new ProviderWrapper(content, myContext)), content).setObject(content).setPreferredFocusableComponent(content.getPreferredFocusableComponent()).setActionsContextComponent(content.getActionsContextComponent());
    myContents.remove(content);
    myContents.put(content, tabInfo);
    ActionGroup group = (ActionGroup) myContext.getActionManager().getAction(RunnerContentUi.VIEW_TOOLBAR);
    tabInfo.setTabLabelActions(group, ViewContext.CELL_TOOLBAR_PLACE);
    tabInfo.setDragOutDelegate(((RunnerContentUi) myContext).myDragOutDelegate);
    return tabInfo;
}
Also used : ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) TabInfo(com.intellij.ui.tabs.TabInfo)

Example 5 with TabInfo

use of com.intellij.ui.tabs.TabInfo in project intellij-community by JetBrains.

the class GridCellImpl method closeOrMinimize.

public void closeOrMinimize(MouseEvent e) {
    TabInfo tabInfo = myTabs.findInfo(e);
    if (tabInfo == null)
        return;
    Content content = getContentFor(tabInfo);
    if (CloseViewAction.isEnabled(new Content[] { content })) {
        CloseViewAction.perform(myContext, content);
    } else if (MinimizeViewAction.isEnabled(myContext, getContents(), ViewContext.CELL_TOOLBAR_PLACE)) {
        minimize(content);
    }
}
Also used : Content(com.intellij.ui.content.Content) TabInfo(com.intellij.ui.tabs.TabInfo)

Aggregations

TabInfo (com.intellij.ui.tabs.TabInfo)41 TabLabel (com.intellij.ui.tabs.impl.TabLabel)6 RelativePoint (com.intellij.ui.awt.RelativePoint)4 JBTabsImpl (com.intellij.ui.tabs.impl.JBTabsImpl)4 Content (com.intellij.ui.content.Content)3 JBTabs (com.intellij.ui.tabs.JBTabs)3 TabsListener (com.intellij.ui.tabs.TabsListener)3 NonOpaquePanel (com.intellij.ui.components.panels.NonOpaquePanel)2 ContentManager (com.intellij.ui.content.ContentManager)2 PyDebugProcess (com.jetbrains.python.debugger.PyDebugProcess)2 ArrayList (java.util.ArrayList)2 EmptyBorder (javax.swing.border.EmptyBorder)2 Nullable (org.jetbrains.annotations.Nullable)2 BuckSettingsProvider (com.facebook.buck.intellij.ideabuck.config.BuckSettingsProvider)1 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)1 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 Editor (com.intellij.openapi.editor.Editor)1 FileDocumentManager (com.intellij.openapi.fileEditor.FileDocumentManager)1