* 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
This commit is contained in:
Gregory John Casamento 2010-02-08 11:43:41 +00:00
parent b1b23f9a77
commit e296fcf111
3 changed files with 38 additions and 15 deletions

View file

@ -1,3 +1,8 @@
2010-02-08 06:46-EST Gregory John Casamento <greg.casamento@gmail.com>
* GormCore/GormServer.h: Added deleteClass: method
* Gorm.m: Added implementation for deleteClass:
2010-02-07 05:43-EST Gregory John Casamento <greg.casamento@gmail.com> 2010-02-07 05:43-EST Gregory John Casamento <greg.casamento@gmail.com>
* GormCore/GNUmakefile: Added GormServer.h to the headers. * GormCore/GNUmakefile: Added GormServer.h to the headers.

47
Gorm.m
View file

@ -175,21 +175,6 @@
[super dealloc]; [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 - (void) stop: (id)sender
{ {
if(isTesting == NO) if(isTesting == NO)
@ -1314,4 +1299,36 @@
{ {
[[self keyWindow] print: sender]; [[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 @end

View file

@ -24,6 +24,7 @@
@protocol GormServer @protocol GormServer
- (void) addClass: (NSDictionary *)dict; - (void) addClass: (NSDictionary *)dict;
- (void) deleteClass: (NSString *)className;
@end @end
#endif #endif