// // PGPDocument.m // Pretty Good Pilot // // Copyright © 2006 Wilfredo Sánchez Vega. All rights reserved. // #import #import "PGPDocument.h" @implementation PGPDocument - (id) init { if ((self = [super init])) { [aircraftTypesController setSelectsInsertedObjects: YES]; } return self; } - (NSString *) windowNibName { return @"PGPDocument"; } - (void) addAndSetAircraftType:(id)sender { NSManagedObjectContext *context = [self managedObjectContext]; NSManagedObject *newType = [NSEntityDescription insertNewObjectForEntityForName:@"AircraftType" inManagedObjectContext:context]; [aircraftTypesController addObject: newType]; [[[aircraftController selectedObjects] lastObject] setValue: newType forKey: @"type"]; } - (void) windowControllerDidLoadNib: (NSWindowController*) aWindowController { [super windowControllerDidLoadNib:aWindowController]; } @end