From 4e4dc272ec09447176a88ccc7df47b37512af563 Mon Sep 17 00:00:00 2001 From: Kirill Kirichenko Date: Fri, 3 Nov 2017 16:49:13 +0300 Subject: [PATCH] IDEA-174108 Add space between cancel button and progressbar, change Darcula colors --- .../laf/darcula/ui/DarculaProgressBarUI.java | 2 +- .../impl/status/InlineProgressIndicator.java | 24 ++++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaProgressBarUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaProgressBarUI.java index ca4d21d455b6..b5f90510eb44 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaProgressBarUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaProgressBarUI.java @@ -24,7 +24,7 @@ public class DarculaProgressBarUI extends BasicProgressBarUI { private static final Color REMAINDER_COLOR = new JBColor(() -> UIUtil.isUnderWin10LookAndFeel() ? Gray.xCC : - new JBColor(Gray.xC4, Gray.x69)); + new JBColor(Gray.xC4, Gray.x55)); @SuppressWarnings("UseJBColor") private static final Color FINISHED_COLOR = new JBColor(() -> UIUtil.isUnderWin10LookAndFeel() ? diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java index 5d81832cc0cc..c76ff2f87435 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/InlineProgressIndicator.java @@ -23,6 +23,7 @@ import com.intellij.openapi.progress.TaskInfo; import com.intellij.openapi.progress.util.ProgressIndicatorBase; import com.intellij.openapi.ui.GraphicsConfig; import com.intellij.openapi.ui.popup.IconButton; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.ColorUtil; import com.intellij.ui.InplaceButton; import com.intellij.ui.components.panels.NonOpaquePanel; @@ -30,11 +31,11 @@ import com.intellij.ui.components.panels.Wrapper; import com.intellij.util.containers.JBIterable; import com.intellij.util.ui.GraphicsUtil; import com.intellij.util.ui.GridBag; +import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import javax.swing.*; -import javax.swing.border.EmptyBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -73,14 +74,9 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di JPanel textAndProgress = new NonOpaquePanel(new BorderLayout()); textAndProgress.add(myText, BorderLayout.CENTER); - final NonOpaquePanel progressWrapper = new NonOpaquePanel(new GridBagLayout()); - progressWrapper.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0)); - final GridBagConstraints c = new GridBagConstraints(); - c.weightx = 1; - c.weighty = 1; - c.insets = new Insets(1, 0, 1, myInfo.isCancellable() ? 0 : 4); - c.fill = GridBagConstraints.HORIZONTAL; - progressWrapper.add(myProgress, c); + final NonOpaquePanel progressWrapper = new NonOpaquePanel(new BorderLayout()); + progressWrapper.setBorder(JBUI.Borders.empty(0, 4)); + progressWrapper.add(myProgress, BorderLayout.CENTER); textAndProgress.add(progressWrapper, BorderLayout.EAST); myComponent.add(textAndProgress, BorderLayout.CENTER); @@ -91,10 +87,10 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di myProcessName.setText(processInfo.getTitle()); myComponent.add(myProcessName, BorderLayout.NORTH); myProcessName.setForeground(UIUtil.getPanelBackground().brighter().brighter()); - myProcessName.setBorder(new EmptyBorder(2, 2, 2, 2)); + myProcessName.setBorder(JBUI.Borders.empty(2)); final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout()); - content.setBorder(new EmptyBorder(2, 2, 2, myInfo.isCancellable() ? 2 : 4)); + content.setBorder(JBUI.Borders.empty(2, 2, 2, myInfo.isCancellable() ? 2 : 4)); myComponent.add(content, BorderLayout.CENTER); content.add(createButtonPanel(myEastButtons.map(b -> withBorder(b.button))), BorderLayout.EAST); @@ -102,7 +98,7 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di content.add(myProgress, BorderLayout.CENTER); content.add(myText2, BorderLayout.SOUTH); - myComponent.setBorder(new EmptyBorder(2, 2, 2, 2)); + myComponent.setBorder(JBUI.Borders.empty(2)); } if (!myCompact) { @@ -124,7 +120,7 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di private static Wrapper withBorder(InplaceButton button) { Wrapper wrapper = new Wrapper(button); - wrapper.setBorder(new EmptyBorder(0, 3, 0, 2)); + wrapper.setBorder(JBUI.Borders.empty(0, 3, 0, 2)); return wrapper; } @@ -181,7 +177,7 @@ public class InlineProgressIndicator extends ProgressIndicatorBase implements Di myText.setText(getText() != null ? getText() : ""); myText2.setText(getText2() != null ? getText2() : ""); - if (myCompact && myText.getText().isEmpty()) { + if (myCompact && StringUtil.isEmpty(myText.getText())) { myText.setText(myInfo.getTitle()); }