From 9a5cb83cdf913e616a0f96f4f720dc3187d650ce Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 13 Apr 2015 17:04:21 +0200 Subject: Dim the database name in relations view if foreign database == local database. --- Source/SPTableRelations.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index 2374ea81..5734a96d 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -376,7 +376,13 @@ static NSString *SPRelationOnDeleteKey = @"on_delete"; - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex { - return [[relationData objectAtIndex:rowIndex] objectForKey:[tableColumn identifier]]; + id data = [[relationData objectAtIndex:rowIndex] objectForKey:[tableColumn identifier]]; + //dim the database name if it matches the current database + if([[tableColumn identifier] isEqualToString:SPRelationFKDatabaseKey] && [[tableDocumentInstance database] isEqual:data]) { + NSDictionary *textAttributes = @{NSForegroundColorAttributeName: [NSColor lightGrayColor]}; + data = [[[NSAttributedString alloc] initWithString:(NSString *)data attributes:textAttributes] autorelease]; + } + return data; } #pragma mark - -- cgit v1.2.3