forked from pmougin/F-Script
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathFSObjectBrowserCell.m
97 lines (75 loc) · 2.24 KB
/
FSObjectBrowserCell.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// FSObjectBrowserCell.m Copyright (c) 2001-2009 Philippe Mougin.
// This software is open source. See the license.
#import "FSObjectBrowserCell.h"
#import <ExceptionHandling/NSExceptionHandler.h>
#import "FSNSObject.h"
@implementation FSObjectBrowserCell
+ (NSImage *)branchImage {return nil; /* No branch image */ }
- (id) autorelease
{
//NSLog(@"autorelease called");
return [super autorelease];
}
- (enum FSObjectBrowserCellType)objectBrowserCellType { return objectBrowserCellType; }
- (NSString *)classLabel { return classLabel; }
-(void) dealloc
{
[label release];
[classLabel release];
[super dealloc];
}
- (id)init
{
if ((self = [super init]))
{
objectBrowserCellType = FSOBUNKNOWN;
return self;
}
return nil;
}
- (NSString *)label { return label; }
- (oneway void) release
{
//NSLog(@"release called");
[super release];
}
- (id)representedObject
{
if (objectBrowserCellType == FSOBCLASS)
{
NSUInteger exceptionHandlingMask = [[NSExceptionHandler defaultExceptionHandler] exceptionHandlingMask];
Class class = NSClassFromString([[self stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]);
[[NSExceptionHandler defaultExceptionHandler] setExceptionHandlingMask:63];
@try
{
if (![class conformsToProtocol:@protocol(FSNSObject)]) class = nil; // This can raise since class might not recognize the conformsToProtocol: message
}
@catch (id exception)
{
class = nil;
}
// Restore the original exception handling mask
[[NSExceptionHandler defaultExceptionHandler] setExceptionHandlingMask:exceptionHandlingMask];
return class;
}
else return [super representedObject];
}
- (void) setObjectBrowserCellType:(enum FSObjectBrowserCellType)theObjectBrowserCellType { objectBrowserCellType = theObjectBrowserCellType;}
- (void) setClassLabel:(NSString *)theClassLabel
{
[theClassLabel retain];
[classLabel release];
classLabel = theClassLabel;
}
- (void) setLabel:(NSString *)theLabel
{
[theLabel retain];
[label release];
label = theLabel;
}
/*- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
{
NSLog(@"startTrackingAt:");
return NO;
}*/
@end