adjust borders in show overrides popup title panel
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 1 Mar 2016 08:51:18 +0000 (11:51 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 1 Mar 2016 08:52:10 +0000 (11:52 +0300)
platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java
platform/util/src/com/intellij/ui/CaptionPanel.java

index 11a2dc2fd5e4a005bba467cbfddb86c0c6e6b157..76959083f905d2fa33461b9c7d4dc750e58345e3 100644 (file)
@@ -269,24 +269,14 @@ public class AbstractPopup implements JBPopup {
         myCaption.setButtonComponent(new InplaceButton(
           new IconButton("Open as Tool Window", 
                          AllIcons.General.AutohideOff, AllIcons.General.AutohideOff, AllIcons.General.AutohideOffInactive),
-          new ActionListener() {
-            @Override
-            public void actionPerformed(final ActionEvent e) {
-              pinCallback.process(AbstractPopup.this);
-            }
-          }
-        ));
+          e -> pinCallback.process(this)
+        ), JBUI.Borders.empty(4));
       }
       else if (cancelButton != null) {
-        myCaption.setButtonComponent(new InplaceButton(cancelButton, new ActionListener() {
-          @Override
-          public void actionPerformed(final ActionEvent e) {
-            cancel();
-          }
-        }));
+        myCaption.setButtonComponent(new InplaceButton(cancelButton, e -> cancel()), JBUI.Borders.empty(4));
       }
       else if (commandButton != null) {
-        myCaption.setButtonComponent(commandButton);
+        myCaption.setButtonComponent(commandButton, null);
       }
     }
     else {
index 9cbd9e879418aa061d4e536804f53abb204b1c64..929e0b2de8a24b09129619186ec018e93e9e0c9c 100644 (file)
@@ -18,9 +18,10 @@ package com.intellij.ui;
 
 import com.intellij.util.ui.UIUtil;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
-import javax.swing.border.EmptyBorder;
+import javax.swing.border.Border;
 import java.awt.*;
 import java.awt.event.MouseEvent;
 
@@ -106,11 +107,12 @@ public class CaptionPanel extends JPanel {
     repaint();
   }
 
-  public void setButtonComponent(@NotNull ActiveComponent component) {
+  public void setButtonComponent(@NotNull ActiveComponent component, @Nullable Border border) {
     if (myButtonComponent != null) {
       remove(myButtonComponent.getComponent());
     }
     JPanel panel = new JPanel(new BorderLayout());
+    panel.setBorder(border);
     panel.add(new JLabel(" "), BorderLayout.WEST);
     panel.add(component.getComponent(), BorderLayout.CENTER);
     panel.setOpaque(false);