Revision: 11539
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=11539&view=rev
Author:   hofman
Date:     2007-11-11 09:29:10 -0800 (Sun, 11 Nov 2007)

Log Message:
-----------
Changes for new Omni frameworks, in particular for change in OFError macros.

Modified Paths:
--------------
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKAppController.m
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKBibTeXParser.m
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m
    branches/TRY_ARM_FILE_INTERFACE/bibdesk/NSError_BDSKExtensions.h

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKAppController.m
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKAppController.m 2007-11-11 
17:16:32 UTC (rev 11538)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKAppController.m 2007-11-11 
17:29:10 UTC (rev 11539)
@@ -1248,7 +1248,7 @@
 
         NSString *cachePath = [fileManager 
spotlightCacheFolderPathByCreating:&error];
         if(cachePath == nil){
-            OFErrorWithInfo(&error, NSCocoaErrorDomain, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable to create the cache 
folder for Spotlight metadata.", @"Error description"), nil);
+            OFErrorWithInfo(&error, kBDSKFileOperationFailed, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable to create the cache 
folder for Spotlight metadata.", @"Error description"), nil);
             @throw [NSException 
exceptionWithName:NSInternalInconsistencyException reason:[NSString 
stringWithFormat:@"Unable to build metadata cache at path \"[EMAIL 
PROTECTED]"", cachePath] userInfo:nil];
         }
         

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKBibTeXParser.m
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKBibTeXParser.m  2007-11-11 
17:16:32 UTC (rev 11538)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BDSKBibTeXParser.m  2007-11-11 
17:29:10 UTC (rev 11539)
@@ -311,7 +311,7 @@
         
     // generic error message; the error tableview will have specific errors 
and context
     if(parsed_ok == 0 || hadProblems){
-        OFErrorWithInfo(&error, BDSKParserError, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Unable to parse string as BibTeX", @"Error description"), 
nil);
+        OFErrorWithInfo(&error, kBDSKParserFailed, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Unable to parse string as BibTeX", @"Error description"), 
nil);
         
     // If no critical errors, warn about ignoring macros or frontmatter; 
callers can ignore this by passing a valid NSMutableString for frontmatter (or 
ignoring the partial data flag).  Mainly relevant for paste/drag on the 
document.
     } else if (ignoredMacros && ignoredFrontmatter) {
@@ -800,7 +800,7 @@
             NSString *message = NSLocalizedString(@"Macro leads to circular 
definition, ignored.", @"Error description");            
             [BDSKErrorObject reportError:message forFile:filePath 
line:field->line];
             
-            OFErrorWithInfo(error, BDSKParserError, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Circular macro ignored.", @"Error description"), nil);
+            OFErrorWithInfo(error, kBDSKParserFailed, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Circular macro ignored.", 
@"Error description"), nil);
         }else if(nil != macroString){
             [macroResolver addMacroDefinitionWithoutUndo:macroString 
forMacro:macroKey];
         }else {

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m       2007-11-11 
17:16:32 UTC (rev 11538)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/BibDocument.m       2007-11-11 
17:29:10 UTC (rev 11539)
@@ -1026,7 +1026,7 @@
                 
                 if ([fm fileExistsAtPath:targetPath])
                     targetPath = [fm uniqueFilePathWithName:[targetPath 
stringByDeletingLastPathComponent] atPath:[targetPath lastPathComponent]];
-                @try { [fm createPathToFile:targetPath attributes:nil]; }
+                @try { [fm createPathToFile:targetPath attributes:nil 
error:NULL]; }
                 @catch (id exception) {
                     success = NO;
                     NSLog(@"Ignoring exception %@ while creating path to 
file", exception);
@@ -1343,7 +1343,7 @@
     NSString *RISString = [self RISStringForPublications:items];
     NSData *data = [RISString dataUsingEncoding:encoding 
allowLossyConversion:NO];
     if (nil == data && error) {
-        OFErrorWithInfo(error, "BDSKSaveError", NSLocalizedDescriptionKey, 
[NSString stringWithFormat:NSLocalizedString(@"Unable to convert the 
bibliography to encoding %@", @"Error description"), [NSString 
localizedNameOfStringEncoding:encoding]], NSStringEncodingErrorKey, [NSNumber 
numberWithInt:encoding], nil);
+        OFErrorWithInfo(error, kBDSKDocumentSaveError, 
NSLocalizedDescriptionKey, [NSString 
stringWithFormat:NSLocalizedString(@"Unable to convert the bibliography to 
encoding %@", @"Error description"), [NSString 
localizedNameOfStringEncoding:encoding]], NSStringEncodingErrorKey, [NSNumber 
numberWithInt:encoding], nil);
     }
        return data;
 }
@@ -1359,7 +1359,7 @@
     NSString *ltbString = [pboard stringForType:NSStringPboardType];
     [pboardHelper clearPromisedTypesForPasteboard:pboard];
        if(ltbString == nil){
-        if (error) OFErrorWithInfo(error, "BDSKSaveError", 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable to run TeX processes for 
these publications", @"Error description"), nil);
+        if (error) OFErrorWithInfo(error, kBDSKDocumentSaveError, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable to run TeX processes for 
these publications", @"Error description"), nil);
                return nil;
     }
     
@@ -1369,7 +1369,7 @@
     
     NSData *data = [s dataUsingEncoding:encoding allowLossyConversion:NO];
     if (nil == data && error) {
-        OFErrorWithInfo(error, "BDSKSaveError", NSLocalizedDescriptionKey, 
[NSString stringWithFormat:NSLocalizedString(@"Unable to convert the 
bibliography to encoding %@", @"Error description"), [NSString 
localizedNameOfStringEncoding:encoding]], NSStringEncodingErrorKey, [NSNumber 
numberWithInt:encoding], nil);
+        OFErrorWithInfo(error, kBDSKDocumentSaveError, 
NSLocalizedDescriptionKey, [NSString 
stringWithFormat:NSLocalizedString(@"Unable to convert the bibliography to 
encoding %@", @"Error description"), [NSString 
localizedNameOfStringEncoding:encoding]], NSStringEncodingErrorKey, [NSNumber 
numberWithInt:encoding], nil);
     }        
        return data;
 }
@@ -1512,7 +1512,7 @@
                // sniff the string to see what format we got
                NSString *string = [[[NSString alloc] initWithData:data 
encoding:encoding] autorelease];
                if(string == nil){
-            OFErrorWithInfo(&error, BDSKParserError, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable To Open Document", 
@"Error description"), NSLocalizedRecoverySuggestionErrorKey, 
NSLocalizedString(@"This document does not appear to be a text file.", @"Error 
informative text"), nil);
+            OFErrorWithInfo(&error, kBDSKParserFailed, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable To Open Document", 
@"Error description"), NSLocalizedRecoverySuggestionErrorKey, 
NSLocalizedString(@"This document does not appear to be a text file.", @"Error 
informative text"), nil);
             if(outError) *outError = error;
             
             // bypass the partial data warning, since we have no data
@@ -1522,13 +1522,13 @@
         if(type == BDSKBibTeXStringType){
             success = [self readFromBibTeXData:data fromURL:absoluteURL 
encoding:encoding error:&error];
                }else if (type == BDSKNoKeyBibTeXStringType){
-            OFErrorWithInfo(&error, BDSKParserError, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable To Open Document", 
@"Error description"), NSLocalizedRecoverySuggestionErrorKey, 
NSLocalizedString(@"This file appears to contain invalid BibTeX because of 
missing cite keys. Try to open using temporary cite keys to fix this.", @"Error 
informative text"), nil);
+            OFErrorWithInfo(&error, kBDSKParserFailed, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable To Open Document", 
@"Error description"), NSLocalizedRecoverySuggestionErrorKey, 
NSLocalizedString(@"This file appears to contain invalid BibTeX because of 
missing cite keys. Try to open using temporary cite keys to fix this.", @"Error 
informative text"), nil);
             if (outError) *outError = error;
             
             // bypass the partial data warning; we have no data in this case
             return NO;
                }else if (type == BDSKUnknownStringType){
-            OFErrorWithInfo(&error, BDSKParserError, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable To Open Document", 
@"Error description"), NSLocalizedRecoverySuggestionErrorKey, 
NSLocalizedString(@"This text file does not contain a recognized data type.", 
@"Error informative text"), nil);
+            OFErrorWithInfo(&error, kBDSKParserFailed, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Unable To Open Document", 
@"Error description"), NSLocalizedRecoverySuggestionErrorKey, 
NSLocalizedString(@"This text file does not contain a recognized data type.", 
@"Error informative text"), nil);
             if (outError) *outError = error;
             
             // bypass the partial data warning; we have no data in this case
@@ -1599,7 +1599,7 @@
     NSArray *newPubs = nil;
     
     if(dataString == nil){
-        OFErrorWithInfo(&error, BDSKParserError, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Unable to Interpret", @"Error description"), 
NSLocalizedRecoverySuggestionErrorKey, [NSString 
stringWithFormat:NSLocalizedString(@"Unable to interpret data as [EMAIL 
PROTECTED]  Try a different encoding.", @"Error informative text"), [NSString 
localizedNameOfStringEncoding:encoding]], NSStringEncodingErrorKey, [NSNumber 
numberWithInt:encoding], nil);
+        OFErrorWithInfo(&error, kBDSKParserFailed, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Unable to Interpret", @"Error description"), 
NSLocalizedRecoverySuggestionErrorKey, [NSString 
stringWithFormat:NSLocalizedString(@"Unable to interpret data as [EMAIL 
PROTECTED]  Try a different encoding.", @"Error informative text"), [NSString 
localizedNameOfStringEncoding:encoding]], NSStringEncodingErrorKey, [NSNumber 
numberWithInt:encoding], nil);
         if(outError)    *outError = error;
         return NO;
     }
@@ -1869,7 +1869,7 @@
             newPubs = [self newPublicationForURL:pbURL error:&error];
        }else{
         // errors are key, value
-        OFErrorWithInfo(&error, BDSKParserError, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Did not find anything appropriate on the pasteboard", 
@"Error description"), nil);
+        OFErrorWithInfo(&error, kBDSKParserFailed, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Did not find anything appropriate on the pasteboard", 
@"Error description"), nil);
        }
     
     if (newPubs == nil){
@@ -1989,7 +1989,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
-        OFErrorWithInfo(&parseError, BDSKParserError, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Temporary Cite Keys", @"Error 
description"), @"temporaryCiteKey", @"FixMe", nil);
+        OFErrorWithInfo(&parseError, kBDSKParserFailed, 
NSLocalizedDescriptionKey, NSLocalizedString(@"Temporary Cite Keys", @"Error 
description"), @"temporaryCiteKey", @"FixMe", nil);
     }
     
        if(outError) *outError = parseError;
@@ -2106,7 +2106,7 @@
 
 - (NSArray *)newPublicationForURL:(NSURL *)url error:(NSError **)error {
     if(url == nil){
-        OFErrorWithInfo(error, BDSKParserError, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Did not find expected URL on the pasteboard", @"Error 
description"), nil);
+        OFErrorWithInfo(error, kBDSKParserFailed, NSLocalizedDescriptionKey, 
NSLocalizedString(@"Did not find expected URL on the pasteboard", @"Error 
description"), nil);
         return nil;
     }
     

Modified: branches/TRY_ARM_FILE_INTERFACE/bibdesk/NSError_BDSKExtensions.h
===================================================================
--- branches/TRY_ARM_FILE_INTERFACE/bibdesk/NSError_BDSKExtensions.h    
2007-11-11 17:16:32 UTC (rev 11538)
+++ branches/TRY_ARM_FILE_INTERFACE/bibdesk/NSError_BDSKExtensions.h    
2007-11-11 17:29:10 UTC (rev 11539)
@@ -53,6 +53,8 @@
     kBDSKFileNotFound,                           /* File not found (should 
have URL/path)   */
     kBDSKAppleScriptError,                       /* AppleScript failed         
             */
     kBDSKParserIgnoredFrontMatter,               /* BDSKBibTeXParser ignored 
front matter       */
+    kBDSKParserFailed,                           /* Some parser failed for 
some reason      */
+    kBDSKFileOperationFailed,                    /* Generic file operation 
failure          */
 };
 
 extern NSString *BDSKUnderlyingItemErrorKey;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to