27 - (void)establishConnection
29 var selectorName = _label,
30 selectorNameLength = [selectorName length];
32 if (selectorNameLength && selectorName.charAt(selectorNameLength - 1) !==
':')
41 raise:CPInvalidArgumentException
42 reason:@"-[" + [
self className] + ' ' + _cmd + @"] selector " + selectorName + @" does not exist."];
46 if (_destination && ![_destination respondsToSelector:selector])
47 CPLog.warn(
@"Could not connect the action " + selector +
@" to target of class " + [_destination className]);
50 if ([_source respondsToSelector:
@selector(setAction:)])
51 [_source setAction:selector];
55 raise:CPInvalidArgumentException
56 reason:@"-[" + [
self className] + ' ' + _cmd + @"] " + [_source description] + @" does not respond to setAction:"];
59 if ([_source respondsToSelector:
@selector(setTarget:)])
60 [_source setTarget:_destination];
64 raise:CPInvalidArgumentException
65 reason:@"-[" + [
self className] + ' ' + _cmd + @"] " + [_source description] + @" does not respond to setTarget:"];
Used to implement exception handling (creating & raising).
void raise:reason:(CPString aName, [reason] CPString aReason)
function CPSelectorFromString(aSelectorName)