void () { final DomElement domElement = getDomElement(); if (domElement == null || !domElement.isValid()) return; final EditorTextField textField = getEditorTextField(getComponent()); final Project project = getProject(); ApplicationManager.getApplication().invokeLater(() -> { if (!project.isOpen()) return; if (!getDomWrapper().isValid()) return; final DomElement domElement1 = getDomElement(); if (domElement1 == null || !domElement1.isValid()) return; final DomElementAnnotationsManager manager = DomElementAnnotationsManager.getInstance(project); final DomElementsProblemsHolder holder = manager.getCachedProblemHolder(domElement1); final List<DomElementProblemDescriptor> errorProblems = holder.getProblems(domElement1); final List<DomElementProblemDescriptor> warningProblems = new ArrayList<>(holder.getProblems(domElement1, true, HighlightSeverity.WARNING)); warningProblems.removeAll(errorProblems); Color background = getDefaultBackground(); if (errorProblems.size() > 0 && textField.getText().trim().length() == 0) { background = getErrorBackground(); } else if (warningProblems.size() > 0) { background = getWarningBackground(); } final Editor editor = textField.getEditor(); if (editor != null) { final MarkupModel markupModel = editor.getMarkupModel(); markupModel.removeAllHighlighters(); if (!errorProblems.isEmpty() && editor.getDocument().getLineCount() > 0) { markupModel.addLineHighlighter(CodeInsightColors.ERRORS_ATTRIBUTES, 0, 0); editor.getContentComponent().setToolTipText(errorProblems.get(0).getDescriptionTemplate()); } } textField.setBackground(background); }); }