mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Added fix to remove connections when variable or method name is modified.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@15049 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
19a757b582
commit
da8436ae2d
3 changed files with 71 additions and 8 deletions
|
@ -1,3 +1,12 @@
|
|||
2002-11-22 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* GormDocument.[hm]: added -[GormDocument removeConnectionsWithLabel:
|
||||
(NSString *)name forClassNamed: (NSString *)className
|
||||
isAction: (BOOL)action. This method removes the connections relavent
|
||||
to an action/outlet when it's name is changed. I also modified the
|
||||
delegate to call it and to present the user w/ an alert panel. This
|
||||
is consistent w/ how InterfaceBuilder behaves.
|
||||
|
||||
2002-11-20 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* GModelDecoder.m
|
||||
|
|
|
@ -114,6 +114,9 @@
|
|||
// Internals support
|
||||
- (void) rebuildObjToNameMapping;
|
||||
- (id) parseHeader: (NSString *)headerPath;
|
||||
- (void) removeConnectionsWithLabel: (NSString *)name
|
||||
forClassNamed: (NSString *)className
|
||||
isAction: (BOOL)action;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2742,6 +2742,43 @@ static NSImage *classesImage = nil;
|
|||
return identifier;
|
||||
}
|
||||
|
||||
- (void) removeConnectionsWithLabel: (NSString *)name
|
||||
forClassNamed: (NSString *)className
|
||||
isAction: (BOOL)action
|
||||
{
|
||||
NSEnumerator *en = [connections objectEnumerator];
|
||||
id<IBConnectors> c = nil;
|
||||
|
||||
// remove all.
|
||||
while((c = [en nextObject]) != nil)
|
||||
{
|
||||
id proxy = nil;
|
||||
NSString *label = [c label];
|
||||
|
||||
if(action)
|
||||
{
|
||||
if(![label hasSuffix: @":"])
|
||||
continue;
|
||||
proxy = [c destination];
|
||||
}
|
||||
else
|
||||
{
|
||||
if([label hasSuffix: @":"])
|
||||
continue;
|
||||
proxy = [c source];
|
||||
}
|
||||
|
||||
if([label isEqualToString: name] &&
|
||||
[[proxy className] isEqualToString: className])
|
||||
{
|
||||
[self removeConnector: c];
|
||||
}
|
||||
}
|
||||
|
||||
// done...
|
||||
NSDebugLog(@"Removed references to %@ on %@",name, className);
|
||||
}
|
||||
|
||||
// --- NSOutlineView dataSource ---
|
||||
- (id) outlineView: (NSOutlineView *)anOutlineView
|
||||
objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
||||
|
@ -2789,10 +2826,17 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
if(![classManager isAction: formattedAction
|
||||
ofClass: [gov itemBeingEdited]])
|
||||
{
|
||||
[classManager replaceAction: name
|
||||
withAction: formattedAction
|
||||
forClassNamed: [gov itemBeingEdited]];
|
||||
[(GormOutletActionHolder *)item setName: formattedAction];
|
||||
NSString *msg = [NSString stringWithFormat: @"This will break all connections to '%@'. Continue?",
|
||||
name];
|
||||
int retval = NSRunAlertPanel(@"Renaming action",msg,@"OK",@"Cancel",nil,nil);
|
||||
if(retval == NSAlertDefaultReturn)
|
||||
{
|
||||
[self removeConnectionsWithLabel: name forClassNamed: [gov itemBeingEdited] isAction: YES];
|
||||
[classManager replaceAction: name
|
||||
withAction: formattedAction
|
||||
forClassNamed: [gov itemBeingEdited]];
|
||||
[(GormOutletActionHolder *)item setName: formattedAction];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2811,10 +2855,17 @@ objectValueForTableColumn: (NSTableColumn *)aTableColumn
|
|||
if(![classManager isOutlet: formattedOutlet
|
||||
ofClass: [gov itemBeingEdited]])
|
||||
{
|
||||
[classManager replaceOutlet: name
|
||||
withOutlet: formattedOutlet
|
||||
forClassNamed: [gov itemBeingEdited]];
|
||||
[(GormOutletActionHolder *)item setName: formattedOutlet];
|
||||
NSString *msg = [NSString stringWithFormat: @"This will break all connections to '%@'. Continue?",
|
||||
name];
|
||||
int retval = NSRunAlertPanel(@"Renaming outlet",msg,@"OK",@"Cancel",nil,nil);
|
||||
if(retval == NSAlertDefaultReturn)
|
||||
{
|
||||
[self removeConnectionsWithLabel: name forClassNamed: [gov itemBeingEdited] isAction: NO];
|
||||
[classManager replaceOutlet: name
|
||||
withOutlet: formattedOutlet
|
||||
forClassNamed: [gov itemBeingEdited]];
|
||||
[(GormOutletActionHolder *)item setName: formattedOutlet];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue