private void showEditorWarningMessage(final String message) {
    ApplicationManager.getApplication()
        .invokeLater(
            () -> {
              if (myEditor == null) return;
              final FileEditorManager fileEditorManager = FileEditorManager.getInstance(myProject);
              final VirtualFile vFile = myFile.getVirtualFile();
              assert vFile != null;
              Map<FileEditor, EditorNotificationPanel> map =
                  myFile.getCopyableUserData(NOTIFICATION_PANELS);
              if (map == null) {
                map = new HashMap<FileEditor, EditorNotificationPanel>();
                myFile.putCopyableUserData(NOTIFICATION_PANELS, map);
              }

              final FileEditor[] editors = fileEditorManager.getAllEditors(vFile);
              for (final FileEditor editor : editors) {
                if (isCurrentEditor(editor)) {
                  final EditorNotificationPanel panel =
                      new EditorNotificationPanel() {
                        {
                          myLabel.setIcon(AllIcons.General.ExclMark);
                          myLabel.setText(message);
                        }
                      };
                  panel.createActionLabel(
                      "Close", () -> fileEditorManager.removeTopComponent(editor, panel));
                  map.put(editor, panel);
                  fileEditorManager.addTopComponent(editor, panel);
                  break;
                }
              }
            });
  }
 private RangeHighlighter addSegmentHighlighter(
     @NotNull Editor editor,
     int startOffset,
     int endOffset,
     TextAttributes attributes,
     @HideFlags int flags) {
   RangeHighlighter highlighter =
       editor
           .getMarkupModel()
           .addRangeHighlighter(
               startOffset,
               endOffset,
               HighlighterLayer.SELECTION - 1,
               attributes,
               HighlighterTargetArea.EXACT_RANGE);
   HighlightInfo info =
       new HighlightInfo(
           editor instanceof EditorWindow ? ((EditorWindow) editor).getDelegate() : editor, flags);
   Map<RangeHighlighter, HighlightInfo> map = getHighlightInfoMap(editor, true);
   map.put(highlighter, info);
   return highlighter;
 }