Revision: 18478
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18478&view=rev
Author: hofman
Date: 2012-02-03 16:07:32 +0000 (Fri, 03 Feb 2012)
Log Message:
-----------
show errors from generic string parser on paste/drag when verbose
Modified Paths:
--------------
trunk/bibdesk/BibDocument.m
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2012-02-03 12:57:58 UTC (rev 18477)
+++ trunk/bibdesk/BibDocument.m 2012-02-03 16:07:32 UTC (rev 18478)
@@ -2307,21 +2307,14 @@
if([type isEqualToString:BDSKBibItemPboardType]){
NSData *pbData = [pb dataForType:BDSKBibItemPboardType];
newPubs = [BibItem publicationsFromArchivedData:pbData
macroResolver:[self macroResolver]];
- }else if([type isEqualToString:NSStringPboardType] || [type
isEqualToString:BDSKReferenceMinerStringPboardType]){
+ }else if([type isEqualToString:BDSKReferenceMinerStringPboardType]){
NSString *pbString = [pb stringForType:NSStringPboardType];
- NSInteger stringType = [type
isEqualToString:BDSKReferenceMinerStringPboardType] ?
BDSKReferenceMinerStringType : BDSKUnknownStringType;
+ // sniffing the string for RIS is broken because RefMiner puts junk at
the beginning
+ newPubs = [BDSKStringParser itemsFromString:pbString
ofType:BDSKReferenceMinerStringType owner:self error:&error];
+ }else if([type isEqualToString:NSStringPboardType]){
+ NSString *pbString = [pb stringForType:NSStringPboardType];
// sniff the string to see what its type is
- // sniffing the string for RIS is broken because RefMiner puts junk at
the beginning
- newPubs = [BDSKStringParser itemsFromString:pbString
ofType:stringType owner:self error:&error];
- if([error isLocalError]){
- if ([error code] == kBDSKParserIgnoredFrontMatter){
- if (verbose) [self presentError:error];
- error = nil;
- }else if([error code] == kBDSKBibTeXParserFailed){
- if(verbose == NO || [self presentError:error] == NO)
- newPubs = nil;
- }
- }
+ newPubs = [BDSKStringParser itemsFromString:pbString
ofType:BDSKUnknownStringType owner:self error:&error];
}else if([type isEqualToString:NSFilenamesPboardType]){
NSArray *pbArray = [pb
propertyListForType:NSFilenamesPboardType]; // we will get an array
// try this first, in case these files are a type we can open
@@ -2346,14 +2339,24 @@
newPubs = newPubs ? [newPubs
arrayByAddingObjectsFromArray:newFilePubs]: newFilePubs;
}
- if([error isLocalError]){
- if([error code] == kBDSKHadMissingCiteKeys) {
- temporaryCiteKey = [[error userInfo]
objectForKey:@"temporaryCiteKey"];
- error = nil; // accept temporary cite keys, but show a warning
later
- }
+ if([error isLocalError] && [error code] == kBDSKHadMissingCiteKeys) {
+ temporaryCiteKey = [[error userInfo] objectForKey:@"temporaryCiteKey"];
+ error = nil; // accept temporary cite keys, but show a warning later
+ }else if([error isLocalError] && [error code] ==
kBDSKParserIgnoredFrontMatter){
+ // just warn about this error when verbose, don't treat this as an
error further
+ if (verbose)
+ [self presentError:error];
+ error = nil;
+ }else if([error isLocalError] && [error code] == kBDSKBibTeXParserFailed){
+ // this asks whether to ignore partially failed bibtex when verbose,
otherwise just ignore, for NSFilenamesPboardType this was already handled
+ if([type isEqualToString:NSFilenamesPboardType] == NO && (verbose ==
NO || [self presentError:error] == NO))
+ newPubs = nil;
+ }else if(error && verbose){
+ // display error for non-bibtex string parsers when verbose
+ [self presentError:error];
}
- if ([newPubs count] > 0)
+ if([newPubs count] > 0)
[self addPublications:newPubs
publicationsToAutoFile:newFilePubs temporaryCiteKey:temporaryCiteKey
selectLibrary:shouldSelect edit:shouldEdit];
else if (newPubs == nil && outError)
*outError = error;
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