Search in sources :

Example 6 with TabInfo

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

the class JBRunnerTabs method processDropOver.

@Override
public void processDropOver(TabInfo over, RelativePoint relativePoint) {
    final Point point = relativePoint.getPoint(getComponent());
    myShowDropLocation = shouldAddToGlobal(point);
    super.processDropOver(over, relativePoint);
    for (Map.Entry<TabInfo, TabLabel> entry : myInfo2Label.entrySet()) {
        final TabLabel label = entry.getValue();
        if (label.getBounds().contains(point) && myDropInfo != entry.getKey()) {
            select(entry.getKey(), false);
            break;
        }
    }
}
Also used : TabLabel(com.intellij.ui.tabs.impl.TabLabel) TabInfo(com.intellij.ui.tabs.TabInfo) RelativePoint(com.intellij.ui.awt.RelativePoint) Map(java.util.Map)

Example 7 with TabInfo

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

the class RunnerContentUi method validate.

@Override
public void validate(Content content, final ActiveRunnable toRestore) {
    final TabInfo current = myTabs.getSelectedInfo();
    myTabs.getPresentation().setPaintBlocked(true, true);
    select(content, false).doWhenDone(() -> {
        myTabs.getComponent().validate();
        toRestore.run().doWhenDone(() -> {
            assert current != null;
            myTabs.select(current, true);
            myTabs.getPresentation().setPaintBlocked(false, true);
        });
    });
}
Also used : TabInfo(com.intellij.ui.tabs.TabInfo)

Example 8 with TabInfo

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

the class RunnerContentUi method updateTabsUI.

private void updateTabsUI(final boolean validateNow) {
    boolean hasToolbarContent = rebuildToolbar();
    Set<String> usedNames = new HashSet<>();
    List<TabInfo> tabs = myTabs.getTabs();
    for (TabInfo each : tabs) {
        hasToolbarContent |= updateTabUI(each, usedNames);
    }
    int tabsCount = tabs.size() + myChildren.stream().mapToInt(child -> child.myTabs.getTabCount()).sum();
    myTabs.getPresentation().setHideTabs(!hasToolbarContent && tabsCount <= 1 && myOriginal == null);
    myTabs.updateTabActions(validateNow);
    if (validateNow) {
        myTabs.sortTabs(myTabsComparator);
    }
}
Also used : TabInfo(com.intellij.ui.tabs.TabInfo) RelativePoint(com.intellij.ui.awt.RelativePoint)

Example 9 with TabInfo

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

the class RunnerContentUi method updateTabsIndices.

private static int updateTabsIndices(final JBRunnerTabs tabs, int offset) {
    for (TabInfo each : tabs.getTabs()) {
        final int index = tabs.getIndexOf(each);
        final TabImpl tab = getTabFor(each);
        if (tab != null)
            tab.setIndex(index >= 0 ? index + offset : index);
    }
    return offset + tabs.getTabCount();
}
Also used : TabInfo(com.intellij.ui.tabs.TabInfo) RelativePoint(com.intellij.ui.awt.RelativePoint)

Example 10 with TabInfo

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

the class RunnerContentUi method getGridFor.

@Nullable
private GridImpl getGridFor(@NotNull Content content, boolean createIfMissing) {
    GridImpl grid = (GridImpl) findGridFor(content);
    if (grid != null || !createIfMissing)
        return grid;
    grid = new GridImpl(this, mySessionName);
    if (myCurrentOver != null || myOriginal != null) {
        Integer forcedDropIndex = content.getUserData(RunnerLayout.DROP_INDEX);
        final int index = myTabs.getDropInfoIndex() + (myOriginal != null ? myOriginal.getTabOffsetFor(this) : 0);
        final int dropIndex = forcedDropIndex != null ? forcedDropIndex : index;
        if (forcedDropIndex == null) {
            moveFollowingTabs(dropIndex);
        }
        final int defaultIndex = content.getUserData(RunnerLayout.DEFAULT_INDEX);
        final TabImpl tab = myLayoutSettings.getOrCreateTab(forcedDropIndex != null ? forcedDropIndex : -1);
        tab.setDefaultIndex(defaultIndex);
        tab.setIndex(dropIndex);
        getStateFor(content).assignTab(tab);
        content.putUserData(RunnerLayout.DROP_INDEX, null);
        content.putUserData(RunnerLayout.DEFAULT_INDEX, null);
    }
    TabInfo tab = new TabInfo(grid).setObject(getStateFor(content).getTab()).setText("Tab");
    Wrapper left = new Wrapper();
    myCommonActionsPlaceholder.put(grid, left);
    Wrapper minimizedToolbar = new Wrapper();
    myMinimizedButtonsPlaceholder.put(grid, minimizedToolbar);
    final Wrapper searchComponent = new Wrapper();
    if (content.getSearchComponent() != null) {
        searchComponent.setContent(content.getSearchComponent());
    }
    TwoSideComponent right = new TwoSideComponent(searchComponent, minimizedToolbar);
    NonOpaquePanel sideComponent = new TwoSideComponent(left, right);
    tab.setSideComponent(sideComponent);
    tab.setTabLabelActions((ActionGroup) myActionManager.getAction(VIEW_TOOLBAR), TAB_TOOLBAR_PLACE);
    myTabs.addTab(tab);
    myTabs.sortTabs(myTabsComparator);
    return grid;
}
Also used : Wrapper(com.intellij.ui.components.panels.Wrapper) NonOpaquePanel(com.intellij.ui.components.panels.NonOpaquePanel) TabInfo(com.intellij.ui.tabs.TabInfo) RelativePoint(com.intellij.ui.awt.RelativePoint) Nullable(org.jetbrains.annotations.Nullable)

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