public static void ShowRenameComponentDialog(Component component) { var document = GetDocumentByComponent(component); var form = new OKCancelTextBoxForm(EditorLocalization.TranslateLabel("General", "Name:"), component.Name, EditorLocalization.Translate("General", "Rename"), delegate(string text, ref string error) { if (!ComponentUtility.IsValidComponentName(text, out string error2)) { error = error2; return(false); } return(true); }, delegate(string text, ref string error) { if (text != component.Name) { var oldValue = component.Name; //change Name component.Name = text; //undo var undoItems = new List <UndoActionPropertiesChange.Item>(); var property = (Metadata.Property)MetadataManager.GetTypeOfNetType( typeof(Component)).MetadataGetMemberBySignature("property:Name"); undoItems.Add(new UndoActionPropertiesChange.Item(component, property, oldValue, new object[0])); var action = new UndoActionPropertiesChange(undoItems.ToArray()); document.UndoSystem.CommitAction(action); document.Modified = true; } return(true); } ); form.ShowDialog(); }