public void setTabLayoutPolicy(final int policy) { switch (policy) { case JTabbedPane.SCROLL_TAB_LAYOUT: myTabs.getPresentation().setSingleRow(true); break; case JTabbedPane.WRAP_TAB_LAYOUT: myTabs.getPresentation().setSingleRow(false); break; default: throw new IllegalArgumentException("Unsupported tab layout policy: " + policy); } }
public void setTabPlacement(final int tabPlacement) { switch (tabPlacement) { case SwingConstants.TOP: myTabs.getPresentation().setTabsPosition(JBTabsPosition.top); break; case SwingConstants.BOTTOM: myTabs.getPresentation().setTabsPosition(JBTabsPosition.bottom); break; case SwingConstants.LEFT: myTabs.getPresentation().setTabsPosition(JBTabsPosition.left); break; case SwingConstants.RIGHT: myTabs.getPresentation().setTabsPosition(JBTabsPosition.right); break; default: throw new IllegalArgumentException("Unknown tab placement code=" + tabPlacement); } }
private void updateTabBorder() { if (!myProject.isOpen()) return; ToolWindowManagerEx mgr = (ToolWindowManagerEx) ToolWindowManager.getInstance(myProject); String[] ids = mgr.getToolWindowIds(); Insets border = new Insets(0, 0, 0, 0); UISettings uiSettings = UISettings.getInstance(); List<String> topIds = mgr.getIdsOn(ToolWindowAnchor.TOP); List<String> bottom = mgr.getIdsOn(ToolWindowAnchor.BOTTOM); List<String> rightIds = mgr.getIdsOn(ToolWindowAnchor.RIGHT); List<String> leftIds = mgr.getIdsOn(ToolWindowAnchor.LEFT); if (!uiSettings.HIDE_TOOL_STRIPES) { border.top = topIds.size() > 0 ? 1 : 0; border.bottom = bottom.size() > 0 ? 1 : 0; border.left = leftIds.size() > 0 ? 1 : 0; border.right = rightIds.size() > 0 ? 1 : 0; } for (String each : ids) { ToolWindow eachWnd = mgr.getToolWindow(each); if (!eachWnd.isAvailable()) continue; if (eachWnd.isVisible() && eachWnd.getType() == ToolWindowType.DOCKED) { ToolWindowAnchor eachAnchor = eachWnd.getAnchor(); if (eachAnchor == ToolWindowAnchor.TOP) { border.top = 0; } else if (eachAnchor == ToolWindowAnchor.BOTTOM) { border.bottom = 0; } else if (eachAnchor == ToolWindowAnchor.LEFT) { border.left = 0; } else if (eachAnchor == ToolWindowAnchor.RIGHT) { border.right = 0; } } } myTabs .getPresentation() .setPaintBorder(border.top, border.left, border.right, border.bottom) .setTabSidePaintBorder(5); }