/// <inheritdoc/>
            public override bool ShouldEditTableColumn(NSTableView tableView, NSTableColumn tableColumn, nint row)
            {
                var programDescription = Programs.ArrangedObjects()[row] as ProgramDescriptionViewModel;
                var canEdit            = RomListCommandGroup.EditProgramNameCommand.CanExecute(ViewModel);

                if (canEdit)
                {
                    string initialValue = null;
                    var    column       = (RomListColumn)tableView.TableColumns().ToList().IndexOf(tableColumn);
                    int    maxLength    = -1;
                    System.Predicate <char> isValidCharacter = null;
                    switch (column)
                    {
                    case RomListColumn.Title:
                        canEdit      = true;
                        initialValue = programDescription.Name;
                        maxLength    = ProgramDescription.MaxProgramNameLength;
                        break;

                    case RomListColumn.Vendor:
                        canEdit      = true;
                        initialValue = programDescription.Vendor;
                        maxLength    = ProgramDescription.MaxVendorNameLength;
                        break;

                    case RomListColumn.Year:
                        canEdit          = true;
                        initialValue     = programDescription.Year;
                        maxLength        = ProgramDescription.MaxYearTextLength;
                        isValidCharacter = (c) => char.IsDigit(c);
                        break;

                    default:
                        break;
                    }
                    if (canEdit)
                    {
                        if (InPlaceEditor == null)
                        {
                            InPlaceEditor = new TextCellInPlaceEditor(tableView);
                        }
                        InPlaceEditor.EditingObject    = programDescription;
                        InPlaceEditor.InitialValue     = initialValue;
                        InPlaceEditor.MaxLength        = maxLength;
                        InPlaceEditor.IsValidCharacter = isValidCharacter;
                        InPlaceEditor.EditorClosed    += InPlaceEditor_EditorClosed;
                        InPlaceEditor.BeginEdit();
                    }
                }
                else if ((SingleInstanceApplication.Current.LastKeyPressed == 0x24) && (SingleInstanceApplication.Current.LastKeyPressedTimestamp != ReturnKeyTimestamp))
                {
                    // return was pressed
                    ReturnKeyTimestamp = SingleInstanceApplication.Current.LastKeyPressedTimestamp;
                    DebugItemChange(programDescription.Name);
                    ViewModel.Model.InvokeProgramFromDescription(programDescription.Model);
                }
                return(canEdit);
            }
 public LimitedTextEditing(TextCellInPlaceEditor textEditor)
 {
     Owner = textEditor;
 }