@Override
  public void update(@NotNull AnActionEvent e) {
    VirtualFile[] files = getFiles(e.getDataContext());
    e.getPresentation().setEnabledAndVisible(files.length > 0);
    if (files.length > 0) {
      int ro = 0, rw = 0, f = 0, d = 0;
      for (VirtualFile file : files) {
        if (file.isWritable()) ++rw; else ++ro;
        if (file.isDirectory()) ++d; else ++f;
      }
      int finalRo = ro;
      int finalRw = rw;
      int finalF = f;
      int finalD = d;
      if (ro > 0 && rw > 0) {
        e.getPresentation().setText(ActionsBundle.messagePointer("action.ToggleReadOnlyAttribute.text"));
      }
      else if (f > 0 && d == 0) {
        e.getPresentation().setText(ActionsBundle.messagePointer("action.ToggleReadOnlyAttribute.files", finalRo, finalRw, finalF, finalD));
      }
      else if (f == 0 && d > 0) {
        e.getPresentation().setText(ActionsBundle.messagePointer("action.ToggleReadOnlyAttribute.dirs", finalRo, finalRw, finalF, finalD));
      }
      else {
        e.getPresentation().setText(ActionsBundle.messagePointer("action.ToggleReadOnlyAttribute.mixed", finalRo, finalRw, finalF, finalD));
      }
    }
  }
@Override
  public void update(@NotNull AnActionEvent e)