@Override
  public void editorReleased(@NotNull EditorFactoryEvent event) {
    Project project = event.getEditor().getProject();
    if (project != null) {
      ImageOrColorPreviewService service = project.getServiceIfCreated(ImageOrColorPreviewService.class);
      if (service != null) {
        service.detach(event.getEditor());
      }
    }
  }
@Override
  public void editorReleased(@NotNull EditorFactoryEvent event)