From 0b542737cc7c0dfd04271c89c9a46c6fefd90a7e Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Tue, 3 Nov 2015 00:12:43 +0300 Subject: [PATCH] hyperlink label: extract a common constructor --- .../intellij/ui/EditorNotificationPanel.java | 5 ++--- .../src/com/intellij/ui/HyperlinkLabel.java | 17 ++++++----------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java index 732d021b78b1..f78d4f86aea1 100644 --- a/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java +++ b/platform/platform-api/src/com/intellij/ui/EditorNotificationPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.ui.components.panels.HorizontalLayout; import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.util.ui.JBUI; -import com.intellij.util.ui.PlatformColors; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -86,7 +85,7 @@ public class EditorNotificationPanel extends JPanel { } public HyperlinkLabel createActionLabel(final String text, final Runnable action) { - HyperlinkLabel label = new HyperlinkLabel(text, PlatformColors.BLUE, getBackground(), PlatformColors.BLUE); + HyperlinkLabel label = new HyperlinkLabel(text, getBackground()); label.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(HyperlinkEvent e) { diff --git a/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java b/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java index d9f44b41ddce..8c920d6221be 100644 --- a/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java +++ b/platform/platform-api/src/com/intellij/ui/HyperlinkLabel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,16 +67,11 @@ public class HyperlinkLabel extends HighlightableComponent { } public HyperlinkLabel(String text) { - this(text, - PlatformColors.BLUE, - new JBColor(new NotNullProducer() { - @NotNull - @Override - public Color produce() { - return UIUtil.getLabelBackground(); - } - }), - PlatformColors.BLUE); + this(text, UIUtil.getLabelBackground()); + } + + public HyperlinkLabel(String text, Color background) { + this(text, PlatformColors.BLUE, background, PlatformColors.BLUE); } public HyperlinkLabel(String text, final Color textForegroundColor, final Color textBackgroundColor, final Color textEffectColor) {