From 3a037f5eb0d7ffb46dc9b3e19c95cb379a297632 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Fri, 26 May 2017 00:57:20 +0300 Subject: [PATCH] IDEA-165037 Move tab close button to the left on MacOS --- .../src/com/intellij/ui/tabs/impl/TabLabel.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java index d73f1bce9bc7..d4b2378aee66 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLabel.java @@ -46,6 +46,8 @@ import java.awt.event.*; import java.awt.image.BufferedImage; public class TabLabel extends JPanel implements Accessible { + // If this System property is set to true 'close' button would be shown on the left of text (it's on the right by default) + private static final String BUTTON_ON_THE_LEFT_KEY = "closeTabButtonOnTheLeft"; protected final SimpleColoredComponent myLabel; private final LayeredIcon myIcon; @@ -219,7 +221,12 @@ public class TabLabel extends JPanel implements Accessible { public Insets getInsets() { Insets insets = super.getInsets(); if (myTabs.isEditorTabs() && UISettings.getShadowInstance().getShowCloseButton()) { + if (Boolean.getBoolean(BUTTON_ON_THE_LEFT_KEY)) { + insets.left = 3; + } + else { insets.right = 3; + } } return insets; } @@ -506,7 +513,7 @@ public class TabLabel extends JPanel implements Accessible { toggleShowActions(false); - add(myActionPanel, BorderLayout.EAST); + add(myActionPanel, Boolean.getBoolean(BUTTON_ON_THE_LEFT_KEY) ? BorderLayout.WEST : BorderLayout.EAST); myTabs.revalidateAndRepaint(false); }