mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 22:20:44 +00:00
Add delegate method to handle renaming connections
This commit is contained in:
parent
cc34827230
commit
dd33778535
4 changed files with 24 additions and 18 deletions
|
@ -190,6 +190,20 @@
|
|||
return (retval == NSAlertDefaultReturn);
|
||||
}
|
||||
|
||||
- (BOOL) shouldRenameConnectionsForClassNamed: (NSString *)className toClassName: (NSString *)newName
|
||||
{
|
||||
NSInteger retval = -1;
|
||||
NSString *title = [NSString stringWithFormat: @"%@", _(@"Modifying Class")];
|
||||
NSString *msgFormat = _(@"Change class name '%@' to '%@'. Continue?");
|
||||
NSString *msg = [NSString stringWithFormat:
|
||||
msgFormat,
|
||||
className, newName];
|
||||
|
||||
// ask the user if he/she wants to continue...
|
||||
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
|
||||
return (retval == NSAlertDefaultReturn);
|
||||
}
|
||||
|
||||
- (BOOL) isInTool
|
||||
{
|
||||
return NO;
|
||||
|
|
|
@ -2825,24 +2825,9 @@ static void _real_close(GormDocument *self,
|
|||
{
|
||||
NSEnumerator *en = [connections objectEnumerator];
|
||||
id<IBConnectors> c = nil;
|
||||
BOOL renamed = YES;
|
||||
NSInteger retval = -1;
|
||||
NSString *title = [NSString stringWithFormat: @"%@", _(@"Modifying Class")];
|
||||
NSString *msgFormat = _(@"Change class name '%@' to '%@'. Continue?");
|
||||
NSString *msg = [NSString stringWithFormat:
|
||||
msgFormat,
|
||||
className, newName];
|
||||
|
||||
// ask the user if he/she wants to continue...
|
||||
retval = NSRunAlertPanel(title, msg,_(@"OK"),_(@"Cancel"), nil, nil);
|
||||
if (retval == NSAlertDefaultReturn)
|
||||
{
|
||||
renamed = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
renamed = NO;
|
||||
}
|
||||
id delegate = [NSApp delegate];
|
||||
BOOL renamed = [delegate shouldRenameConnectionsForClassNamed: className
|
||||
toClassName: newName];
|
||||
|
||||
// remove all.
|
||||
if(renamed)
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
- (BOOL) shouldUpgradeOlderArchive;
|
||||
- (BOOL) shouldLoadNewerArchive;
|
||||
- (BOOL) shouldBreakConnectionsForClassNamed: (NSString *)className;
|
||||
- (BOOL) shouldRenameConnectionsForClassNamed: (NSString *)className toClassName: (NSString *)newName;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -53,6 +53,12 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) shouldRenameConnectionsForClassNamed: (NSString *)className toClassName: (NSString *)newName
|
||||
{
|
||||
NSLog(@"Renaming connections from class %@ to class %@", className, newName);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSDictionary *) parseArguments
|
||||
{
|
||||
GormDocumentController *dc = [GormDocumentController sharedDocumentController];
|
||||
|
|
Loading…
Reference in a new issue