// // NGAConditionalExecutor.m // P4Menu // // Created by Michael Bishop on 9/29/11. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import "NGAConditionalExecutor.h" #import "NGAUtilities.h" @interface NGAConditionalExecutor () -(NSDictionary*)currentDictionaryWithValues; @end @implementation NGAConditionalExecutor +(id)executorWithConditionalKeyPaths:(NSArray*)keypaths object:(id)object { return AUTORELEASE([[NGAConditionalExecutor alloc] initWithConditionalKeyPaths:keypaths object:object]); } -(id)init { return [self initWithConditionalKeyPaths:nil object:nil]; } - (id)initWithConditionalKeyPaths:(NSArray*)keypaths object:(id)object { if ((self = [super init]) == nil) return nil; _keypaths = [keypaths copy]; _object = object; _values = [[self currentDictionaryWithValues] copy]; return self; } #if !__has_feature(objc_arc) -(void)dealloc { [_values release]; [_keypaths release]; [super dealloc]; } #endif -(NSDictionary*)currentDictionaryWithValues { return [_object dictionaryWithValuesForKeys:_keypaths]; } -(BOOL)conditionallyExecuteBlock:(void(^)())block { if ( ![_values isEqualToDictionary:[self currentDictionaryWithValues]] ) return NO; block(); return YES; } @end
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 20722 | jdputsch | initial branch, prep for -Zapp= support | ||
//guest/michael_bishop/MacMenu/src/NGAUtilities/Source/NGAConditionalExecutor.m | |||||
#1 | 8331 | Matt Attaway |
Adding initial version of MacMenu for Perforce MacMenu is a helpful Perforce client that sits in your toolbar. It allows you to run standard Perforce operations on the document that is open the currently active editor/viewer. |