Revision: 18486
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18486&view=rev
Author: hofman
Date: 2012-02-04 18:05:28 +0000 (Sat, 04 Feb 2012)
Log Message:
-----------
use global strings for error keys
Modified Paths:
--------------
trunk/bibdesk/BDSKErrorObjectController.m
trunk/bibdesk/BDSKStringParser.m
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_Actions.m
trunk/bibdesk/NSError_BDSKExtensions.h
trunk/bibdesk/NSError_BDSKExtensions.m
Modified: trunk/bibdesk/BDSKErrorObjectController.m
===================================================================
--- trunk/bibdesk/BDSKErrorObjectController.m 2012-02-04 17:59:52 UTC (rev
18485)
+++ trunk/bibdesk/BDSKErrorObjectController.m 2012-02-04 18:05:28 UTC (rev
18486)
@@ -49,6 +49,7 @@
#import "NSWindowController_BDSKExtensions.h"
#import "BDSKPublicationsArray.h"
#import "BDSKTableView.h"
+#import "NSError_BDSKExtensions.h"
#define BDSKLineNumberTransformerName @"BDSKLineNumberTransformer"
@@ -395,7 +396,7 @@
// The options are (cancel, keep going, edit)
- (BOOL)attemptRecoveryFromError:(NSError *)error
optionIndex:(NSUInteger)recoveryOptionIndex {
// this is set when the document failed to load
- BibDocument *doc = [[error userInfo] objectForKey:@"failedDocument"];
+ BibDocument *doc = [[error userInfo]
objectForKey:BDSKFailedDocumentErrorKey];
BOOL shouldKeepGoing = recoveryOptionIndex == 1;
BOOL shouldEdit = recoveryOptionIndex == 2;
if (doc && shouldKeepGoing == NO)
Modified: trunk/bibdesk/BDSKStringParser.m
===================================================================
--- trunk/bibdesk/BDSKStringParser.m 2012-02-04 17:59:52 UTC (rev 18485)
+++ trunk/bibdesk/BDSKStringParser.m 2012-02-04 18:05:28 UTC (rev 18486)
@@ -127,7 +127,7 @@
// return an error when we inserted temporary keys, let the caller
decide what to do with it
// don't override a parseError though, as that is probably more
relevant
parseError = [NSError
mutableLocalErrorWithCode:kBDSKHadMissingCiteKeys
localizedDescription:NSLocalizedString(@"Temporary Cite Keys", @"Error
description")];
- [parseError setValue:@"FixMe" forKey:@"temporaryCiteKey"];
+ [parseError setValue:@"FixMe" forKey:BDSKTemporaryCiteKeyErrorKey];
}
if(outError) *outError = parseError;
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2012-02-04 17:59:52 UTC (rev 18485)
+++ trunk/bibdesk/BibDocument.m 2012-02-04 18:05:28 UTC (rev 18486)
@@ -1882,7 +1882,7 @@
[recoveryError setValue:NSLocalizedString(@"There was a problem
reading the file. Do you want to give up, edit the file to correct the errors,
or keep going with everything that could be analyzed?\n\nIf you choose \"Keep
Going\" and then save the file, you will probably lose data.", @"Informative
text in alert dialog") forKey:NSLocalizedRecoverySuggestionErrorKey];
[recoveryError setValue:[BDSKErrorObjectController
sharedErrorObjectController] forKey:NSRecoveryAttempterErrorKey];
[recoveryError setValue:[NSArray
arrayWithObjects:NSLocalizedString(@"Give Up", @"Button title"),
NSLocalizedString(@"Keep Going", @"Button title"), NSLocalizedString(@"Edit
File", @"Button title"), nil] forKey:NSLocalizedRecoveryOptionsErrorKey];
- [recoveryError setValue:self forKey:@"failedDocument"];
+ [recoveryError setValue:self forKey:BDSKFailedDocumentErrorKey];
[recoveryError setValue:error forKey:NSUnderlyingErrorKey];
if ([self presentError:recoveryError])
@@ -2329,7 +2329,7 @@
}
if([error isLocalErrorWithCode:kBDSKHadMissingCiteKeys]) {
- temporaryCiteKey = [[error userInfo] objectForKey:@"temporaryCiteKey"];
+ temporaryCiteKey = [[error userInfo]
objectForKey:BDSKTemporaryCiteKeyErrorKey];
error = nil; // accept temporary cite keys, but show a warning later
}else if([error isLocalErrorWithCode:kBDSKParserIgnoredFrontMatter]){
// just warn about this error when verbose, don't treat this as an
error further
Modified: trunk/bibdesk/BibDocument_Actions.m
===================================================================
--- trunk/bibdesk/BibDocument_Actions.m 2012-02-04 17:59:52 UTC (rev 18485)
+++ trunk/bibdesk/BibDocument_Actions.m 2012-02-04 18:05:28 UTC (rev 18486)
@@ -67,6 +67,7 @@
#import "NSViewAnimation_BDSKExtensions.h"
#import "NSAttributedString_BDSKExtensions.h"
#import "NSPrintOperation_BDSKExtensions.h"
+#import "NSError_BDSKExtensions.h"
#import "BDSKTypeManager.h"
#import "BDSKScriptHookManager.h"
@@ -1469,7 +1470,7 @@
NSArray *newPubs = [self extractPublicationsFromFiles:[NSArray
arrayWithObject:fileName] unparseableFiles:NULL verbose:NO error:&error];
BOOL shouldEdit = [[NSUserDefaults standardUserDefaults]
boolForKey:BDSKEditOnPasteKey];
if ([newPubs count]) {
- [self addPublications:newPubs publicationsToAutoFile:nil
temporaryCiteKey:[[error userInfo] valueForKey:@"temporaryCiteKey"]
selectLibrary:YES edit:shouldEdit];
+ [self addPublications:newPubs publicationsToAutoFile:nil
temporaryCiteKey:[[error userInfo] valueForKey:BDSKTemporaryCiteKeyErrorKey]
selectLibrary:YES edit:shouldEdit];
// succeeded to parse the file, we return immediately
} else {
[sheet orderOut:nil];
Modified: trunk/bibdesk/NSError_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSError_BDSKExtensions.h 2012-02-04 17:59:52 UTC (rev
18485)
+++ trunk/bibdesk/NSError_BDSKExtensions.h 2012-02-04 18:05:28 UTC (rev
18486)
@@ -67,7 +67,8 @@
kBDSKHadMissingCiteKeys, /* BibTeX data had missing
cite keys */
};
-extern NSString *BDSKUnderlyingItemErrorKey;
+extern NSString *BDSKFailedDocumentErrorKey;
+extern NSString *BDSKTemporaryCiteKeyErrorKey;
@interface NSError (BDSKExtensions) <NSMutableCopying>
Modified: trunk/bibdesk/NSError_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSError_BDSKExtensions.m 2012-02-04 17:59:52 UTC (rev
18485)
+++ trunk/bibdesk/NSError_BDSKExtensions.m 2012-02-04 18:05:28 UTC (rev
18486)
@@ -39,8 +39,10 @@
#import "NSError_BDSKExtensions.h"
#define BDSKErrorDomain @"net.sourceforge.bibdesk.errors"
-NSString *BDSKUnderlyingItemErrorKey = @"BDSKUnderlyingItemError";
+NSString *BDSKFailedDocumentErrorKey = @"BDSKFailedDocument";
+NSString *BDSKTemporaryCiteKeyErrorKey = @"BDSKTemporaryCiteKey";
+
@interface BDSKMutableError : NSError
{
@private
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit