From e296fcf111e939dc86816ed9418d5c7b90511749 Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Mon, 8 Feb 2010 11:43:41 +0000 Subject: [PATCH] * GormCore/GormServer.h: Added deleteClass: method * Gorm.m: Added implementation for deleteClass: git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@29509 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Gorm.m | 47 +++++++++++++++++++++++++++++-------------- GormCore/GormServer.h | 1 + 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5958c19b..85b54d09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-02-08 06:46-EST Gregory John Casamento + + * GormCore/GormServer.h: Added deleteClass: method + * Gorm.m: Added implementation for deleteClass: + 2010-02-07 05:43-EST Gregory John Casamento * GormCore/GNUmakefile: Added GormServer.h to the headers. diff --git a/Gorm.m b/Gorm.m index 1d2d6867..97092ef3 100644 --- a/Gorm.m +++ b/Gorm.m @@ -175,21 +175,6 @@ [super dealloc]; } -- (void) addClass: (NSDictionary *) dict -{ - GormDocument *doc = (GormDocument *)[self activeDocument]; - GormClassManager *cm = [doc classManager]; - NSArray *outlets = [dict objectForKey: @"outlets"]; - NSArray *actions = [dict objectForKey: @"actions"]; - NSString *className = [dict objectForKey: @"className"]; - NSString *superClassName = [dict objectForKey: @"superClassName"]; - - [cm addClassNamed: className - withSuperClassNamed: superClassName - withActions: actions - withOutlets: outlets]; -} - - (void) stop: (id)sender { if(isTesting == NO) @@ -1314,4 +1299,36 @@ { [[self keyWindow] print: sender]; } + +// Method to support external apps adding and deleting +// classes from the current document... +- (void) addClass: (NSDictionary *) dict +{ + GormDocument *doc = (GormDocument *)[self activeDocument]; + GormClassManager *cm = [doc classManager]; + NSArray *outlets = [dict objectForKey: @"outlets"]; + NSArray *actions = [dict objectForKey: @"actions"]; + NSString *className = [dict objectForKey: @"className"]; + NSString *superClassName = [dict objectForKey: @"superClassName"]; + + // If the class is known, delete it before proceeding. + if([cm isKnownClass: className]) + { + [cm removeClassNamed: className]; + } + + // Add the class to the class manager. + [cm addClassNamed: className + withSuperClassNamed: superClassName + withActions: actions + withOutlets: outlets]; +} + +- (void) deleteClass: (NSString *) className +{ + GormDocument *doc = (GormDocument *)[self activeDocument]; + GormClassManager *cm = [doc classManager]; + + [cm removeClassNamed: className]; +} @end diff --git a/GormCore/GormServer.h b/GormCore/GormServer.h index f807332c..239bdbb9 100644 --- a/GormCore/GormServer.h +++ b/GormCore/GormServer.h @@ -24,6 +24,7 @@ @protocol GormServer - (void) addClass: (NSDictionary *)dict; +- (void) deleteClass: (NSString *)className; @end #endif