Search in sources :

Example 1 with JBTabsImpl

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

the class TableLayout method getDropIndexFor.

@Override
public int getDropIndexFor(Point point) {
    if (myLastTableLayout == null)
        return -1;
    int result = -1;
    Component c = myTabs.getComponentAt(point);
    if (c instanceof JBTabsImpl) {
        for (int i = 0; i < myLastTableLayout.myVisibleInfos.size() - 1; i++) {
            TabLabel first = myTabs.myInfo2Label.get(myLastTableLayout.myVisibleInfos.get(i));
            TabLabel second = myTabs.myInfo2Label.get(myLastTableLayout.myVisibleInfos.get(i + 1));
            Rectangle firstBounds = first.getBounds();
            Rectangle secondBounds = second.getBounds();
            final boolean between = firstBounds.getMaxX() < point.x && secondBounds.getX() > point.x && firstBounds.y < point.y && secondBounds.getMaxY() > point.y;
            if (between) {
                c = first;
                break;
            }
        }
    }
    if (c instanceof TabLabel) {
        TabInfo info = ((TabLabel) c).getInfo();
        int index = myLastTableLayout.myVisibleInfos.indexOf(info);
        boolean isDropTarget = myTabs.isDropTarget(info);
        if (!isDropTarget) {
            for (int i = 0; i <= index; i++) {
                if (myTabs.isDropTarget(myLastTableLayout.myVisibleInfos.get(i))) {
                    index -= 1;
                    break;
                }
            }
            result = index;
        } else if (index < myLastTableLayout.myVisibleInfos.size()) {
            result = index;
        }
    }
    return result;
}
Also used : JBTabsImpl(com.intellij.ui.tabs.impl.JBTabsImpl) TabLabel(com.intellij.ui.tabs.impl.TabLabel) TabInfo(com.intellij.ui.tabs.TabInfo)

Example 2 with JBTabsImpl

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

the class DockableEditorTabbedContainer method add.

@Override
public void add(@NotNull DockableContent content, RelativePoint dropTarget) {
    EditorWindow window = null;
    if (myCurrentOver != null) {
        final DataProvider provider = myCurrentOver.getDataProvider();
        if (provider != null) {
            window = EditorWindow.DATA_KEY.getData(provider);
        }
    }
    final EditorTabbedContainer.DockableEditor dockableEditor = (EditorTabbedContainer.DockableEditor) content;
    VirtualFile file = dockableEditor.getFile();
    if (window == null || window.isDisposed()) {
        window = mySplitters.getOrCreateCurrentWindow(file);
    }
    if (myCurrentOver != null) {
        int index = ((JBTabsImpl) myCurrentOver).getDropInfoIndex();
        file.putUserData(EditorWindow.INITIAL_INDEX_KEY, index);
    }
    ((FileEditorManagerImpl) FileEditorManagerEx.getInstanceEx(myProject)).openFileImpl2(window, file, true);
    window.setFilePinned(file, dockableEditor.isPinned());
}
Also used : DataProvider(com.intellij.openapi.actionSystem.DataProvider) VirtualFile(com.intellij.openapi.vfs.VirtualFile) JBTabsImpl(com.intellij.ui.tabs.impl.JBTabsImpl) RelativePoint(com.intellij.ui.awt.RelativePoint)

Example 3 with JBTabsImpl

use of com.intellij.ui.tabs.impl.JBTabsImpl in project buck by facebook.

the class BuckToolWindowFactory method createToolWindowContent.

@Override
public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
    toolWindow.setAvailable(true, null);
    toolWindow.setToHideOnEmptyContent(true);
    toolWindow.setIcon(BuckIcons.BUCK_TOOL_WINDOW_ICON);
    RunnerLayoutUi runnerLayoutUi = BuckUIManager.getInstance(project).getLayoutUi(project);
    BuckSettingsProvider.State state = BuckSettingsProvider.getInstance().getState();
    JBTabs myTabs = new JBTabsImpl(project);
    // Debug Console
    if (state.showDebug) {
        Content consoleContent = createConsoleContent(runnerLayoutUi, project);
        myTabs.addTab(new TabInfo(consoleContent.getComponent())).setText("Debug");
    }
    // Build Tree Events
    Content treeViewContent = runnerLayoutUi.createContent(BUILD_OUTPUT_PANEL, createBuildInfoPanel(project), "Build Output", null, null);
    myTabs.addTab(new TabInfo(treeViewContent.getComponent()).setText("Build"));
    Content tabsContent = runnerLayoutUi.createContent(TABS_CONTENT_ID, myTabs.getComponent(), "Buck Tool Tabs", null, null);
    runnerLayoutUi.addContent(tabsContent, 0, PlaceInGrid.center, false);
    runnerLayoutUi.getOptions().setLeftToolbar(getLeftToolbarActions(project), ActionPlaces.UNKNOWN);
    runnerLayoutUi.updateActionsNow();
    final ContentManager contentManager = toolWindow.getContentManager();
    Content content = contentManager.getFactory().createContent(runnerLayoutUi.getComponent(), "", true);
    contentManager.addContent(content);
    updateBuckToolWindowTitle(project);
}
Also used : RunnerLayoutUi(com.intellij.execution.ui.RunnerLayoutUi) JBTabs(com.intellij.ui.tabs.JBTabs) JBTabsImpl(com.intellij.ui.tabs.impl.JBTabsImpl) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager) BuckSettingsProvider(com.facebook.buck.intellij.ideabuck.config.BuckSettingsProvider) TabInfo(com.intellij.ui.tabs.TabInfo)

Example 4 with JBTabsImpl

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

the class DisposerDebugger method initUi.

private void initUi() {
    myComponent = new JPanel();
    myTreeTabs = new JBTabsImpl(null, null, this);
    final Splitter splitter = new Splitter(true);
    final JBTabsImpl bottom = new JBTabsImpl(null, null, this);
    final AllocationPanel allocations = new AllocationPanel(myTreeTabs);
    bottom.addTab(new TabInfo(allocations).setText("Allocation")).setActions(allocations.getActions(), ActionPlaces.UNKNOWN);
    splitter.setFirstComponent(myTreeTabs);
    splitter.setSecondComponent(bottom);
    myComponent.setLayout(new BorderLayout());
    myComponent.add(splitter, BorderLayout.CENTER);
    JLabel countLabel = new JLabel("Total disposable count: " + Disposer.getTree().size());
    myComponent.add(countLabel, BorderLayout.SOUTH);
    addTree(new DisposerTree(this), "All", false);
    addTree(new DisposerTree(this), "Watch", true);
}
Also used : Splitter(com.intellij.openapi.ui.Splitter) JBTabsImpl(com.intellij.ui.tabs.impl.JBTabsImpl) TabInfo(com.intellij.ui.tabs.TabInfo)

Aggregations

JBTabsImpl (com.intellij.ui.tabs.impl.JBTabsImpl)4 TabInfo (com.intellij.ui.tabs.TabInfo)3 BuckSettingsProvider (com.facebook.buck.intellij.ideabuck.config.BuckSettingsProvider)1 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)1 DataProvider (com.intellij.openapi.actionSystem.DataProvider)1 Splitter (com.intellij.openapi.ui.Splitter)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 Content (com.intellij.ui.content.Content)1 ContentManager (com.intellij.ui.content.ContentManager)1 JBTabs (com.intellij.ui.tabs.JBTabs)1 TabLabel (com.intellij.ui.tabs.impl.TabLabel)1