mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-02-23 19:51:00 +00:00
Corrected a problem w/ class rename.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@15254 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
244f75ced7
commit
3ca2d79b5b
5 changed files with 69 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
2002-12-05 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormDocument.[mh]: Added method named
|
||||
-[GormDocument renameConnectionsForClassNamed:toName:]
|
||||
to rename the object in the object editor so that the
|
||||
connections stay in sync w/ the new name.
|
||||
* Gorm.m/GormPrivate.h: Added -[GormObjectProxy setClassName:]
|
||||
|
||||
2002-12-04 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version: 0.2.0
|
||||
|
|
6
Gorm.m
6
Gorm.m
|
@ -146,6 +146,12 @@ NSString *GormLinkPboardType = @"GormLinkPboardType";
|
|||
{
|
||||
return @"GormNotApplicableInspector";
|
||||
}
|
||||
|
||||
- (void) setClassName: (NSString *)className
|
||||
{
|
||||
RELEASE(theClass);
|
||||
theClass = [className copy];
|
||||
}
|
||||
@end
|
||||
|
||||
// add methods to all of the template objects for use
|
||||
|
|
|
@ -118,6 +118,8 @@
|
|||
forClassNamed: (NSString *)className
|
||||
isAction: (BOOL)action;
|
||||
- (BOOL) removeConnectionsForClassNamed: (NSString *)name;
|
||||
- (BOOL) renameConnectionsForClassNamed: (NSString *)name
|
||||
toName: (NSString *)newName;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2833,6 +2833,56 @@ static NSImage *classesImage = nil;
|
|||
return removed;
|
||||
}
|
||||
|
||||
- (BOOL) renameConnectionsForClassNamed: (NSString *)className
|
||||
toName: (NSString *)newName
|
||||
{
|
||||
NSEnumerator *en = [connections objectEnumerator];
|
||||
id<IBConnectors> c = nil;
|
||||
BOOL removed = YES;
|
||||
int retval = -1;
|
||||
NSString *title = [NSString stringWithFormat: @"Modifying Class"];
|
||||
NSString *msg = [NSString stringWithFormat:
|
||||
@"Change class name '%@' to '%@'. Continue?",
|
||||
className, newName];
|
||||
|
||||
// ask the user if he/she wants to continue...
|
||||
retval = NSRunAlertPanel(title,msg,@"OK",@"Cancel",nil,nil);
|
||||
if(retval == NSAlertDefaultReturn)
|
||||
{
|
||||
removed = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
removed = NO;
|
||||
}
|
||||
|
||||
// remove all.
|
||||
while((c = [en nextObject]) != nil)
|
||||
{
|
||||
id source = [c source];
|
||||
id destination = [c destination];
|
||||
|
||||
// check both...
|
||||
if([[[c source] className] isEqualToString: className])
|
||||
{
|
||||
[source setClassName: newName];
|
||||
NSLog(@"Found matching source");
|
||||
}
|
||||
else if([[[c destination] className] isEqualToString: className])
|
||||
{
|
||||
[destination setClassName: newName];
|
||||
NSLog(@"Found matching destination");
|
||||
}
|
||||
}
|
||||
|
||||
// Get the object from the object editor so that we can change the name
|
||||
// there too.
|
||||
|
||||
// done...
|
||||
NSDebugLog(@"Changed references to actions/outlets for objects of %@", className);
|
||||
return removed;
|
||||
}
|
||||
|
||||
// --- NSOutlineView dataSource ---
|
||||
- (id) outlineView: (NSOutlineView *)anOutlineView
|
||||
objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
||||
|
@ -2931,8 +2981,8 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
{
|
||||
if(![anObject isEqualToString: @""])
|
||||
{
|
||||
BOOL removed = [self removeConnectionsForClassNamed: item];
|
||||
if(removed)
|
||||
BOOL rename = [self renameConnectionsForClassNamed: item toName: anObject];
|
||||
if(rename)
|
||||
{
|
||||
[classManager renameClassNamed: item newName: anObject];
|
||||
[self detachObject: [self objectForName: item]];
|
||||
|
|
|
@ -26,6 +26,7 @@ extern NSString *GormLinkPboardType;
|
|||
* This is done so that we can provide our own decoding method
|
||||
* (GSNibItem tries to morph into the actual class)
|
||||
*/
|
||||
- (void) setClassName: (NSString *)className;
|
||||
@end
|
||||
|
||||
// Additions to template classes within gorm.
|
||||
|
|
Loading…
Reference in a new issue