@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    GroupItem groupToBeEdited = e.getData(GroupItem.DATA_KEY);
    if (groupToBeEdited == null || project == null) return;

    // Ask group name
    final String groupName = Messages.showInputDialog(
      project,
      UIDesignerBundle.message("edit.enter.group.name"),
      UIDesignerBundle.message("title.edit.group"),
      Messages.getQuestionIcon(),
      groupToBeEdited.getName(),
      null
    );
    if (groupName == null || groupName.equals(groupToBeEdited.getName())) {
      return;
    }

    Palette palette = Palette.getInstance(project);
    List<GroupItem> groups = palette.getGroups();
    for (int i = groups.size() - 1; i >= 0; i--) {
      if (groupName.equals(groups.get(i).getName())) {
        Messages.showErrorDialog(project, UIDesignerBundle.message("error.group.name.unique"),
                                 CommonBundle.getErrorTitle());
        return;
      }
    }

    groupToBeEdited.setName(groupName);
    palette.fireGroupsChanged();
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)