From 4474419405d0cc263bfe7e44e9f77f489d9a8ef2 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Wed, 16 Apr 2014 22:22:30 +0700 Subject: [PATCH] =?UTF-8?q?Use=20API=20available=20on=2010.7=20for=20the?= =?UTF-8?q?=20commit=20window=E2=80=99s=20NSTableView?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We’re using an NSViewController to load the nib so that we do not need to manually release the top level objects. --- Frameworks/CommitWindow/resources/CWTableCellView.xib | 10 +++++++--- Frameworks/CommitWindow/src/CommitWindow.mm | 9 +++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Frameworks/CommitWindow/resources/CWTableCellView.xib b/Frameworks/CommitWindow/resources/CWTableCellView.xib index 1f2fb2ac..062cf216 100644 --- a/Frameworks/CommitWindow/resources/CWTableCellView.xib +++ b/Frameworks/CommitWindow/resources/CWTableCellView.xib @@ -1,10 +1,14 @@ - + - + - + + + + + diff --git a/Frameworks/CommitWindow/src/CommitWindow.mm b/Frameworks/CommitWindow/src/CommitWindow.mm index cbc3371a..61c0d24b 100644 --- a/Frameworks/CommitWindow/src/CommitWindow.mm +++ b/Frameworks/CommitWindow/src/CommitWindow.mm @@ -121,7 +121,6 @@ static NSUInteger const kOakCommitWindowCommitMessagesMax = 5; tableView.menu.delegate = self; _tableView = tableView; - [_tableView registerNib:[[NSNib alloc] initWithNibNamed:@"CWTableCellView" bundle:[NSBundle bundleForClass:[self class]]] forIdentifier:@"path"]; [self populateTableView]; [_tableView bind:NSContentBinding toObject:_arrayController withKeyPath:@"arrangedObjects" options:0]; @@ -586,7 +585,13 @@ static NSUInteger const kOakCommitWindowCommitMessagesMax = 5; - (NSView*)tableView:(NSTableView*)aTableView viewForTableColumn:(NSTableColumn*)aTableColumn row:(NSInteger)row { - CWTableCellView* cellView = [aTableView makeViewWithIdentifier:@"path" owner:self]; + CWTableCellView* cellView = [aTableView makeViewWithIdentifier:aTableColumn.identifier owner:self]; + if(!cellView) + { + NSViewController* viewController = [[NSViewController alloc] initWithNibName:@"CWTableCellView" bundle:[NSBundle bundleForClass:[self class]]]; + cellView = (CWTableCellView*)viewController.view; + cellView.identifier = aTableColumn.identifier; + } [cellView.textField bind:NSValueBinding toObject:cellView withKeyPath:@"objectValue.path" options:0]; [cellView.commitCheckBox bind:NSValueBinding toObject:cellView withKeyPath:@"objectValue.commit" options:0];