aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-01-17 20:24:17 +0000
committerstuconnolly <stuart02@gmail.com>2011-01-17 20:24:17 +0000
commit9533093c9d107acaaf26110a2ae43f484a101419 (patch)
treea6396857b0d71b325f24d9411a1c0c4b5e37617f
parent7988905138341ff08f2a67b625375a12f29889de (diff)
downloadsequelpro-9533093c9d107acaaf26110a2ae43f484a101419.tar.gz
sequelpro-9533093c9d107acaaf26110a2ae43f484a101419.tar.bz2
sequelpro-9533093c9d107acaaf26110a2ae43f484a101419.zip
Add a -description method to SPTreeNode to aid debugging.
-rw-r--r--Source/SPTreeNode.m26
1 files changed, 15 insertions, 11 deletions
diff --git a/Source/SPTreeNode.m b/Source/SPTreeNode.m
index 79217a9f..7be4f09a 100644
--- a/Source/SPTreeNode.m
+++ b/Source/SPTreeNode.m
@@ -250,21 +250,25 @@
#pragma mark -
#pragma mark Other
-/*- (NSComparisonResult)compare:(SPTreeNode *)node
+- (NSString *)description
{
- id selfObject = [self representedObject];
- id nodeObject = [node representedObject];
+ NSMutableString *description = [NSMutableString string];
- if ([selfObject isKindOfClass:[SPFavoriteNode class]] && [nodeObject isKindOfClass:[SPFavoriteNode class]]) {
-
- return [[[selfObject nodeFavorite] objectForKey:SPFavoriteNameKey] localizedCaseInsensitiveCompare:[[nodeObject nodeFavorite] objectForKey:SPFavoriteNameKey]];
- }
- else if ([selfObject isKindOfClass:[SPGroupNode class]] && [nodeObject isKindOfClass:[SPGroupNode class]]) {
+ [description appendString:[[self representedObject] description]];
+ [description appendString:@"\n"];
+
+ NSArray *nodes = [self childNodes];
+
+ for (NSUInteger i = 0; i < [nodes count]; i++)
+ {
+ SPTreeNode *node = [nodes objectAtIndex:i];
+
+ [description appendString:([node isGroup]) ? [node description] : [[node representedObject] description]];
- return [[selfObject nodeName] localizedCaseInsensitiveCompare:[nodeObject nodeName]];
+ if (i < ([nodes count] - 1)) [description appendString:@"\n"];
}
- return NSOrderedSame;
-}*/
+ return description;
+}
@end