@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    ComponentItem selectedItem = e.getData(ComponentItem.DATA_KEY);
    if (project == null || selectedItem == null || selectedItem.isAnyComponent() || selectedItem.isSpacer()) {
      return;
    }

    final ComponentItem itemToBeEdited = selectedItem.clone(); /*"Cancel" should work, so we need edit copy*/
    Window parentWindow = WindowManager.getInstance().suggestParentWindow(project);
    final ComponentItemDialog dialog = new ComponentItemDialog(project, parentWindow, itemToBeEdited, false);
    dialog.setTitle(UIDesignerBundle.message("title.edit.component"));
    if (!dialog.showAndGet()) {
      return;
    }

    GroupItem groupItem = null;
    Palette palette = Palette.getInstance(project);
    // If the itemToBeAdded is already in palette do nothing
    for (GroupItem group : palette.getGroups()) {
      if (group.containsItemCopy(selectedItem, itemToBeEdited.getClassName())) {
        return;
      }
      if (group.containsItemClass(selectedItem.getClassName())) {
        groupItem = group;
      }
    }
    LOG.assertTrue(groupItem != null);

    palette.replaceItem(groupItem, selectedItem, itemToBeEdited);
    palette.fireGroupsChanged();
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)