Revision: 29062
          http://sourceforge.net/p/bibdesk/svn/29062
Author:   hofman
Date:     2025-02-24 17:41:50 +0000 (Mon, 24 Feb 2025)
Log Message:
-----------
Improve nullability for error management objects

Modified Paths:
--------------
    trunk/bibdesk/BDSKErrorManager.h
    trunk/bibdesk/BDSKErrorManager.m
    trunk/bibdesk/BDSKErrorObject.h

Modified: trunk/bibdesk/BDSKErrorManager.h
===================================================================
--- trunk/bibdesk/BDSKErrorManager.h    2025-02-24 16:42:10 UTC (rev 29061)
+++ trunk/bibdesk/BDSKErrorManager.h    2025-02-24 17:41:50 UTC (rev 29062)
@@ -52,21 +52,17 @@
     NSInteger uniqueNumber;
 }
 
-@property (class, nonatomic, nullable, readonly) BDSKErrorManager 
*allItemsErrorManager;
+@property (class, nonatomic, readonly) BDSKErrorManager *allItemsErrorManager;
 
-- (instancetype)initWithDocument:(nullable BibDocument *)aDocument;
+- (instancetype)initWithDocument:(BibDocument *)aDocument;
 
 @property (nonatomic, nullable, weak) BDSKErrorObjectController 
*errorController;
 
 @property (nonatomic, nullable, strong) BibDocument *sourceDocument;
 
-@property (nonatomic, readonly) NSInteger uniqueNumber;
-@property (nonatomic, nullable, strong) NSString *documentDisplayName;
-@property (nonatomic, nullable, readonly) NSString *displayName;
+@property (nonatomic, readonly) NSString *displayName;
 @property (nonatomic, readonly) NSStringEncoding documentStringEncoding;
 
-- (void)updateDisplayName;
-
 @property (nonatomic, nullable, readonly) BDSKErrorEditor *mainEditor;
 
 @property (nonatomic, readonly) NSArray *editors;

Modified: trunk/bibdesk/BDSKErrorManager.m
===================================================================
--- trunk/bibdesk/BDSKErrorManager.m    2025-02-24 16:42:10 UTC (rev 29061)
+++ trunk/bibdesk/BDSKErrorManager.m    2025-02-24 17:41:50 UTC (rev 29062)
@@ -46,6 +46,16 @@
 
 static char BDSKErrorManagerObservationContext;
 
+
+@interface BDSKErrorManager ()
+
+@property (nonatomic, strong) NSString *documentDisplayName;
+@property (nonatomic, readonly) NSInteger uniqueNumber;
+
+- (void)updateDisplayName;
+
+@end
+
 @implementation BDSKErrorManager 
 
 @synthesize errorController, sourceDocument=document, uniqueNumber, 
documentDisplayName, mainEditor, editors;
@@ -67,14 +77,21 @@
         errorController = nil;
         editors = [[NSMutableArray alloc] initWithCapacity:3];
         [self setSourceDocument:aDocument];
-        documentStringEncoding = aDocument ? [aDocument 
documentStringEncoding] : [NSString defaultCStringEncoding];
+        documentStringEncoding = [aDocument documentStringEncoding];
     }
     return self;
 }
 
+// should be used only for allItemsErrorManager
 - (instancetype)init;
 {
-    return [self initWithDocument:nil];
+    if(self = [super init]){
+        errorController = nil;
+        editors = [[NSMutableArray alloc] init];
+        documentDisplayName = NSLocalizedString(@"All", @"Popup menu item for 
error window");
+        documentStringEncoding = [NSString defaultCStringEncoding];
+    }
+    return self;
 }
 
 - (void)dealloc;
@@ -110,13 +127,6 @@
     }
 }
 
-- (void)setDocumentDisplayName:(NSString *)newName;
-{
-    if(newName != documentDisplayName){
-        documentDisplayName = newName;
-    }
-}
-
 - (NSString *)displayName;
 {
     return (uniqueNumber == 0) ? documentDisplayName : [NSString 
stringWithFormat:@"%@ (%ld)", documentDisplayName, (long)uniqueNumber];

Modified: trunk/bibdesk/BDSKErrorObject.h
===================================================================
--- trunk/bibdesk/BDSKErrorObject.h     2025-02-24 16:42:10 UTC (rev 29061)
+++ trunk/bibdesk/BDSKErrorObject.h     2025-02-24 17:41:50 UTC (rev 29062)
@@ -43,7 +43,7 @@
 @class BDSKErrorEditor, BibItem;
 
 @interface BDSKErrorObject : NSObject <NSCopying> {
-       BDSKErrorEditor *editor;
+       __weak BDSKErrorEditor *editor;
        BibItem *publication;
     
     NSString *fileName;
@@ -64,7 +64,7 @@
 @property (nonatomic, readonly) NSString *errorClassName;
 @property (nonatomic, readonly) NSString *errorMessage;
 @property (nonatomic, readonly, getter=isIgnorableWarning) BOOL 
ignorableWarning;
-@property (nonatomic, strong) BDSKErrorEditor *editor;
+@property (nonatomic, nullable, weak) BDSKErrorEditor *editor;
 @property (nonatomic, nullable, strong) BibItem *publication;
 
 @end

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



_______________________________________________
Bibdesk-commit mailing list
Bibdesk-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to