JPanel (@NotNull UIController controller) { JPanel panel = new JPanel(new GridBagLayout()); GridBag gc = new GridBag().nextLine(); if (PowerSaveMode.isEnabled()) { panel.add(new TrackableLinkLabel(EditorBundle.message("iw.disable.powersave"), () ->{ PowerSaveMode.setEnabled(false); hidePopup(); }), gc.next().anchor(GridBagConstraints.LINE_START)); } else { java.util.List<LanguageHighlightLevel> levels = controller.getHighlightLevels(); String msg = null; for (InspectionPopupLevelChangePolicy extension: EP_NAME.getExtensionList()) { msg = extension.getUnavailabilityReason(myEditor); if (msg != null) { break; } } if (levels.size() == 1) { String prefix = EditorBundle.message("iw.highlight.label") + " "; GridBag constrains = gc.next(); // do not create lower panel for code with me guests with no write access if (msg == null) { DropDownLink<?> link = createDropDownLink(levels.get(0), controller, prefix); levelLinks.add(link); panel.add(link, constrains); } else { JLabel noAccessLabel = createNoChangeLabel(levels.get(0), prefix, msg); panel.add(noAccessLabel, constrains); } } else if (levels.size() > 1) { for(LanguageHighlightLevel level: levels) { String prefix = level.getLangID() + ": "; GridBag constrains = gc.next().anchor(GridBagConstraints.LINE_START).gridx > 0 ? gc.insetLeft(8) : gc; // do not create lower panel for code with me guests with no write access if (msg == null) { DropDownLink<?> link = createDropDownLink(level, controller, prefix); levelLinks.add(link); panel.add(link, constrains); } else { JLabel noAccessLabel = createNoChangeLabel(level, prefix, msg); panel.add(noAccessLabel, constrains); } } } } panel.add(Box.createHorizontalGlue(), gc.next().fillCellHorizontally().weightx(1.0)); controller.fillHectorPanels(panel, gc); panel.setOpaque(true); panel.setBackground(UIUtil.getToolTipActionBackground()); panel.setBorder(JBUI.Borders.empty(4, 10)); return panel; }