@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    VirtualFile[] files = getFiles(e.getDataContext());
    if (files.length > 0) {
      WriteAction.run(() -> {
        // Save all documents. We won't be able to save changes to the files that became read-only afterwards.
        FileDocumentManager.getInstance().saveAllDocuments();

        try {
          for (VirtualFile file : files) {
            ReadOnlyAttributeUtil.setReadOnlyAttribute(file, file.isWritable());
          }
        }
        catch (IOException x) {
          Notifications.Bus.notify(
            new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, CommonBundle.getErrorTitle(), x.getMessage(), NotificationType.ERROR),
            e.getProject());
        }
      });
    }
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)