Committing fixes to the class manager.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@14182 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2002-07-21 04:04:18 +00:00
parent 4a3f42c0e9
commit 393b1ebb5c
3 changed files with 68 additions and 8 deletions

View file

@ -1,3 +1,14 @@
2002-07-21 Gregory John Casamento <greg_casamento@yahoo.com>
* GormClassManager.[hm]: Added some methods to support custom
classes:
- (NSArray*) customSubClassesOf: (NSString *)superclass;
- (NSArray*) allCustomSubclassesOf: (NSString *)superclass;
and also made some corrections in the replaceOutlet to correct a
problem with editing in the classes view.
2002-07-16 Gregory John Casamento <greg_casamento@yahoo.com>
* GormObjectInspector.m: Removed extra RELEASE at line 93 which

View file

@ -21,6 +21,8 @@
- (NSArray*) extraActionsForObject: (NSObject*)anObject;
- (NSArray*) extraOutletsForObject: (NSObject*)anObject;
- (NSArray*) subClassesOf: (NSString *)superclass;
- (NSArray*) customSubClassesOf: (NSString *)superclass;
- (NSArray*) allCustomSubclassesOf: (NSString *)superclass;
- (void) removeAction: (NSString*)anAction forObject: (NSObject*)anObject;
- (void) removeOutlet: (NSString*)anOutlet forObject: (NSObject*)anObject;
- (void) removeAction: (NSString*)anAction fromClassNamed: (NSString*)anObject;

View file

@ -241,7 +241,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSMutableDictionary *info = [classInformation objectForKey: className];
NSMutableArray *extraActions = [info objectForKey: @"ExtraActions"];
NSMutableArray *actions = [info objectForKey: @"Actions"];
NSArray *allActions = [self allActionsForClassNamed: className];
NSMutableArray *allActions = [info objectForKey: @"AllActions"];
if([extraActions containsObject: oldAction])
{
@ -249,7 +249,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
int extra_index = [extraActions indexOfObject: oldAction];
[extraActions replaceObjectAtIndex: extra_index withObject: newAction];
[[info objectForKey: @"AllActions"] replaceObjectAtIndex: all_index withObject: newAction];
[allActions replaceObjectAtIndex: all_index withObject: newAction];
}
else if([actions containsObject: oldAction])
{
@ -257,7 +257,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
int actions_index = [actions indexOfObject: oldAction];
[actions replaceObjectAtIndex: actions_index withObject: newAction];
[[info objectForKey: @"AllActions"] replaceObjectAtIndex: all_index withObject: newAction];
[allActions replaceObjectAtIndex: all_index withObject: newAction];
}
}
@ -266,15 +266,15 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
NSMutableDictionary *info = [classInformation objectForKey: className];
NSMutableArray *extraOutlets = [info objectForKey: @"ExtraOutlets"];
NSMutableArray *outlets = [info objectForKey: @"Outlets"];
NSArray *allOutlets = [self allOutletsForClassNamed: className];
NSMutableArray *allOutlets = [info objectForKey: @"AllOutlets"];
if([extraOutlets containsObject: oldOutlet])
{
int all_index = [allOutlets indexOfObject: oldOutlet];
int extra_index = [allOutlets indexOfObject: oldOutlet];
int extra_index = [extraOutlets indexOfObject: oldOutlet];
[extraOutlets replaceObjectAtIndex: extra_index withObject: newOutlet];
[[info objectForKey: @"AllOutlets"] replaceObjectAtIndex: all_index withObject: newOutlet];
[allOutlets replaceObjectAtIndex: all_index withObject: newOutlet];
}
else if([outlets containsObject: oldOutlet])
{
@ -282,7 +282,7 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
int outlets_index = [outlets indexOfObject: oldOutlet];
[outlets replaceObjectAtIndex: outlets_index withObject: newOutlet];
[[info objectForKey: @"AllOutlets"] replaceObjectAtIndex: all_index withObject: newOutlet];
[allOutlets replaceObjectAtIndex: all_index withObject: newOutlet];
}
}
@ -630,6 +630,53 @@ NSString *IBClassNameChangedNotification = @"IBClassNameChangedNotification";
return self;
}
- (void) allSubclassesOf: (NSString *)superclass
referenceClassList: (NSArray *)classList
intoArray: (NSMutableArray *)array
{
NSEnumerator *cen = [classList objectEnumerator];
id object = nil;
while((object = [cen nextObject]))
{
NSDictionary *dictForClass = [classInformation objectForKey: object];
if([[dictForClass objectForKey: @"Super"] isEqual: superclass])
{
[array addObject: object];
[self allSubclassesOf: object
referenceClassList: classList
intoArray: array];
}
}
}
- (NSArray *) allCustomSubclassesOf: (NSString *)superClass
{
NSMutableArray *array = [NSMutableArray array];
[self allSubclassesOf: superClass
referenceClassList: customClasses
intoArray: array];
return array;
}
- (NSArray *) customSubClassesOf: (NSString *)superclass
{
NSEnumerator *cen = [customClasses objectEnumerator];
id object = nil;
NSMutableArray *subclasses = [NSMutableArray array];
while((object = [cen nextObject]))
{
NSDictionary *dictForClass = [classInformation objectForKey: object];
if([[dictForClass objectForKey: @"Super"] isEqual: superclass])
{
[subclasses addObject: object];
}
}
return subclasses;
}
- (NSArray *) subClassesOf: (NSString *)superclass
{
NSArray *allClasses = [classInformation allKeys];
@ -1213,7 +1260,7 @@ selectCellWithString: (NSString*)title
RELEASE(outlets);
RELEASE(okButton);
RELEASE(revertButton);
RELEASE(window);
// RELEASE(window);
[super dealloc];
}