From 633129e3e6ffd9994a92e3ff5bb2e3ef80939a4a Mon Sep 17 00:00:00 2001 From: Gregory John Casamento Date: Mon, 3 May 2021 11:38:48 -0400 Subject: [PATCH] Changes to fix custom class handling. --- Plugins/Xib/GormXibWrapperLoader.m | 43 +++++++++++++++--------------- Resources/ClassInformation.plist | 4 +-- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Plugins/Xib/GormXibWrapperLoader.m b/Plugins/Xib/GormXibWrapperLoader.m index 1d37df60..1a23d234 100644 --- a/Plugins/Xib/GormXibWrapperLoader.m +++ b/Plugins/Xib/GormXibWrapperLoader.m @@ -234,8 +234,15 @@ while ((customClassDict = [en nextObject]) != nil) { NSString *theId = [customClassDict objectForKey: @"id"]; + if ([theId isEqualToString: @"-1"] || + [theId isEqualToString: @"-2"] || + [theId isEqualToString: @"-3"]) + { + continue; + } + NSString *customClassName = [customClassDict objectForKey: @"customClassName"]; - NSString *className = [customClassDict objectForKey: @"parentClassName"]; + NSString *parentClassName = [customClassDict objectForKey: @"parentClassName"]; id realObject = [decoded objectForKey: theId]; NSString *theName = nil; @@ -250,27 +257,21 @@ continue; } - if (![className isEqualToString: @"NSCustomObject"] && - ![className isEqualToString: @"NSCustomObject5"] && - ![className isEqualToString: @"NSApplication"] && - ![className isEqualToString: @"FirstResponder"] && - ![className isEqualToString: @"NSWindowTemplate"]) - { - // Add the class if it is not already known to gorm - if ([classManager isKnownClass: customClassName] == NO) - { - NSLog(@"Adding customClassName = %@ with parent className = %@", customClassName, className); - [classManager addClassNamed: customClassName - withSuperClassNamed: className - withActions: nil - withOutlets: nil - isCustom: YES]; - } - - NSLog(@"Assigning %@ as customClass = %@", theName, customClassName); - [classManager setCustomClass: customClassName - forName: theName]; + if ([parentClassName isEqualToString: @"NSCustomObject5"]) + { + parentClassName = @"NSObject"; } + + NSLog(@"Adding customClassName = %@ with parent className = %@", customClassName, parentClassName); + [classManager addClassNamed: customClassName + withSuperClassNamed: parentClassName + withActions: nil + withOutlets: nil + isCustom: YES]; + + NSLog(@"Assigning %@ as customClass = %@", theName, customClassName); + [classManager setCustomClass: customClassName + forName: theName]; } // diff --git a/Resources/ClassInformation.plist b/Resources/ClassInformation.plist index e8ab9ea4..9cacacfd 100644 --- a/Resources/ClassInformation.plist +++ b/Resources/ClassInformation.plist @@ -414,6 +414,6 @@ Actions = (); Outlets = (); Super = NSArrayController; - }; - Object = {}; + }; + Object = {}; }