Add convenience method for showing an error sheet.

This commit is contained in:
Nathan Kinsinger
2009-12-26 21:06:18 -07:00
parent 9b39d34af4
commit 69c9c57397
2 changed files with 13 additions and 0 deletions
+1
View File
@@ -31,6 +31,7 @@
- (void)useToolbar:(NSToolbar *)toolbar;
- (void)showMessageSheet:(NSString *)messageText infoText:(NSString *)infoText;
- (void)showErrorSheet:(NSError *)error;
- (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output;
- (IBAction) showCommitView:(id)sender;
- (IBAction) showHistoryView:(id)sender;
+12
View File
@@ -137,6 +137,18 @@
[[NSAlert alertWithError:error] beginSheetModalForWindow: [self window] modalDelegate:self didEndSelector:nil contextInfo:nil];
}
- (void)showErrorSheetTitle:(NSString *)title message:(NSString *)message arguments:(NSArray *)arguments output:(NSString *)output
{
NSString *command = [arguments componentsJoinedByString:@" "];
NSString *reason = [NSString stringWithFormat:@"%@\n\ncommand: git %@\n%@", message, command, output];
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
title, NSLocalizedDescriptionKey,
reason, NSLocalizedRecoverySuggestionErrorKey,
nil];
NSError *error = [NSError errorWithDomain:PBGitRepositoryErrorDomain code:0 userInfo:userInfo];
[self showErrorSheet:error];
}
#pragma mark -
#pragma mark Toolbar Delegates