JComponent (Project project) { var promotionKey = "PY_PACKAGES_AD_HIDDEN"; if (PropertiesComponent.getInstance().isValueSet(promotionKey)) return new JLabel(" "); var panel = new BorderLayoutPanel(); panel.setBorder(JBUI.Borders.empty(7)); panel.setAlignmentX(Component.LEFT_ALIGNMENT); JLabel label = new JLabel(PyBundle.message("python.packaging.toolwindow.advertisement")); label.setIcon(AllIcons.Ide.Gift); panel.addToCenter(label); panel.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getColor(PROMOTION_PANE_KEY)); panel.setMinimumSize(new Dimension(400, panel.getMinimumSize().height)); var linkPanel = new NonOpaquePanel(new HorizontalLayout(12)); HyperlinkLabel link = new HyperlinkLabel(PyBundle.message("python.packaging.open.toolwindow.link")); link.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { Window window = ComponentUtil.getActiveWindow(); if (window instanceof DialogWrapperDialog dialog) { dialog.getDialogWrapper().close(DialogWrapper.CANCEL_EXIT_CODE); ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow("Python Packages"); if (toolWindow != null) toolWindow.show(); } } }); linkPanel.add(link); var closeAction = new InplaceButton( new IconButton(IdeBundle.message("do.not.ask.me.again"), AllIcons.Actions.Close, AllIcons.Actions.CloseHovered), e -> { PropertiesComponent.getInstance().setValue(promotionKey, true); panel.removeAll(); panel.setBackground(JBColor.background()); }); linkPanel.add(closeAction); panel.addToRight(linkPanel); return panel; }