@Override
    public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
      if (e == null) return EMPTY_ARRAY;
      Project project = e.getProject();
      if (project == null) return EMPTY_ARRAY;
      ImageTagManager tagManager = ImageTagManager.getInstance(project);
      List<String> tags = tagManager.getAllTags();
      int tagsNumber = tags.size();
      AnAction[] actions = new AnAction[tagsNumber + 1];
      for (int i = 0; i < tagsNumber; i++) {
        String tag = tags.get(i);
        actions[i] = new AnAction(tag) {
          @Override
          public void actionPerformed(@NotNull AnActionEvent e) {
            for (VirtualFile file : thumbnailView.getSelection()) {
              tagManager.addTag(tag, file);
            }

            updateTagsPreviewModel();
          }

          @Override
          public void update(@NotNull AnActionEvent e) {
            e.getPresentation()
              .setEnabledAndVisible(!ContainerUtil.exists(thumbnailView.getSelection(), file -> tagManager.hasTag(tag, file)));
          }

          @Override
          public @NotNull ActionUpdateThread getActionUpdateThread() {
            return ActionUpdateThread.EDT;
          }
        };
      }
      actions[tagsNumber] = new AnAction(IdeBundle.messagePointer("action.Anonymous.text.new.tag")) {
        @Override
        public void actionPerformed(@NotNull AnActionEvent e) {
          ThumbnailView view = ThumbnailViewActionUtil.getVisibleThumbnailView(e);
          if (view != null) {
            VirtualFile[] selection = view.getSelection();
            if (selection.length > 0) {
              String tag = Messages.showInputDialog("", IdeBundle.message("dialog.title.new.tag.name"), null);
              if (tag != null) {
                for (VirtualFile file : selection) {
                  tagManager.addTag(tag, file);
                }
              }
            }
          }
        }
      };

      return actions;
    }
@Override
    public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e)