Component (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final Component component = myRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (!myRoot.isValid()) { return component; } final DomElementAnnotationsManager annotationsManager = DomElementAnnotationsManager.getInstance(myRowDomElement.getManager().getProject()); final DomElementsProblemsHolder holder = annotationsManager.getCachedProblemHolder(myRoot); final List<DomElementProblemDescriptor> errorProblems = holder.getProblems(myCellValueDomElement); final List<DomElementProblemDescriptor> warningProblems = new ArrayList<>(holder.getProblems(myCellValueDomElement, true, HighlightSeverity.WARNING)); warningProblems.removeAll(errorProblems); final boolean hasErrors = errorProblems.size() > 0; if (hasErrors) { component.setForeground(JBColor.RED); if (component instanceof JComponent) { ((JComponent)component).setToolTipText(TooltipUtils.getTooltipText(errorProblems)); } } else { component.setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); if (component instanceof JComponent) { ((JComponent)component).setToolTipText(null); } } // highlight empty cell with errors if (hasErrors && (value == null || value.toString().trim().length() == 0)) { component.setBackground(BaseControl.ERROR_BACKGROUND); } else if (warningProblems.size() > 0) { component.setBackground(BaseControl.WARNING_BACKGROUND); if(isSelected) component.setForeground(JBColor.foreground()); } final List<DomElementProblemDescriptor> errorDescriptors = annotationsManager.getCachedProblemHolder(myRowDomElement).getProblems(myRowDomElement, true, true); if (table.getModel().getColumnCount() - 1 == column) { if (errorDescriptors.size() > 0) { final JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(component, BorderLayout.CENTER); wrapper.setBackground(component.getBackground()); final JLabel errorLabel = new JLabel(getErrorIcon()); wrapper.setToolTipText(TooltipUtils.getTooltipText(errorDescriptors)); wrapper.add(errorLabel, BorderLayout.EAST); if (component instanceof JComponent jComponent) { wrapper.setBorder(jComponent.getBorder()); jComponent.setBorder(BorderFactory.createEmptyBorder()); jComponent.setToolTipText(TooltipUtils.getTooltipText(errorDescriptors)); } return wrapper; } else { if (component instanceof JComponent) { ((JComponent)component).setToolTipText(null); } } } return component; }