mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-23 06:20:47 +00:00
Add delegate method to handle renaming labels on connections
This commit is contained in:
parent
dd33778535
commit
ce1dd3c483
4 changed files with 33 additions and 26 deletions
|
@ -204,6 +204,26 @@
|
|||
return (retval == NSAlertDefaultReturn);
|
||||
}
|
||||
|
||||
- (BOOL) shouldBreakConnectionsModifyingLabel: (NSString *)name isAction: (BOOL)action prompted: (BOOL)prompted
|
||||
{
|
||||
NSString *title;
|
||||
NSString *msg;
|
||||
NSInteger retval;
|
||||
BOOL removed = YES;
|
||||
|
||||
if(prompted == NO)
|
||||
{
|
||||
title = [NSString stringWithFormat:
|
||||
@"Modifying %@",(action==YES?@"Action":@"Outlet")];
|
||||
msg = [NSString stringWithFormat:
|
||||
_(@"This will break all connections to '%@'. Continue?"), name];
|
||||
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
|
||||
// prompted = YES;
|
||||
}
|
||||
|
||||
return (retval == NSAlertDefaultReturn);
|
||||
}
|
||||
|
||||
- (BOOL) isInTool
|
||||
{
|
||||
return NO;
|
||||
|
|
|
@ -2636,7 +2636,8 @@ static void _real_close(GormDocument *self,
|
|||
id<IBConnectors> c = nil;
|
||||
BOOL removed = YES;
|
||||
BOOL prompted = NO;
|
||||
|
||||
id delegate = [NSApp delegate];
|
||||
|
||||
// find connectors to be removed.
|
||||
while ((c = [en nextObject]) != nil)
|
||||
{
|
||||
|
@ -2674,33 +2675,12 @@ static void _real_close(GormDocument *self,
|
|||
if ([label isEqualToString: name] && ([proxyClass isEqualToString: className] ||
|
||||
[classManager isSuperclass: className linkedToClass: proxyClass]))
|
||||
{
|
||||
NSString *title;
|
||||
NSString *msg;
|
||||
NSInteger retval;
|
||||
|
||||
if(prompted == NO)
|
||||
removed = [delegate shouldBreakConnectionsModifyingLabel: name
|
||||
isAction: action
|
||||
prompted: prompted];
|
||||
if (removed)
|
||||
{
|
||||
title = [NSString stringWithFormat:
|
||||
@"Modifying %@",(action==YES?@"Action":@"Outlet")];
|
||||
msg = [NSString stringWithFormat:
|
||||
_(@"This will break all connections to '%@'. Continue?"), name];
|
||||
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
|
||||
prompted = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
removed = NO;
|
||||
break;
|
||||
}
|
||||
|
||||
if (retval == NSAlertDefaultReturn)
|
||||
{
|
||||
removed = YES;
|
||||
[removedConnections addObject: c];
|
||||
}
|
||||
else
|
||||
{
|
||||
removed = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
- (BOOL) shouldLoadNewerArchive;
|
||||
- (BOOL) shouldBreakConnectionsForClassNamed: (NSString *)className;
|
||||
- (BOOL) shouldRenameConnectionsForClassNamed: (NSString *)className toClassName: (NSString *)newName;
|
||||
- (BOOL) shouldBreakConnectionsModifyingLabel: (NSString *)name isAction: (BOOL)action prompted: (BOOL)prompted;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -59,6 +59,12 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) shouldBreakConnectionsModifyingLabel: (NSString *)name isAction: (BOOL)action prompted: (BOOL)prompted
|
||||
{
|
||||
NSLog(@"Breaking connections for %@ %@", action?@"action":@"outlet", name);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSDictionary *) parseArguments
|
||||
{
|
||||
GormDocumentController *dc = [GormDocumentController sharedDocumentController];
|
||||
|
|
Loading…
Reference in a new issue