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);
  }
Exemplo n.º 2
0
 @Override
 public Insets getInsets() {
   Insets insets = super.getInsets();
   if (UIUtil.isUnderGTKLookAndFeel() || UIUtil.isUnderNimbusLookAndFeel()) {
     insets.top += 1;
     insets.bottom += 2;
   }
   return insets;
 }
    @Override
    public Insets getInsets(Insets insets) {
      final Insets result = super.getInsets(insets);

      if (UIUtil.isUnderNimbusLookAndFeel() && !isSmallVariant()) {
        result.top += 2;
        result.left += 8;
        result.bottom += 2;
        result.right += 4 + ARROW_ICON.getIconWidth();
      } else {
        result.right += ARROW_ICON.getIconWidth();
      }

      return result;
    }