Skip to content

Commit 7a18c83

Browse files
author
Chris Wilson
committed
Minor code clean up
1 parent 4b91f24 commit 7a18c83

3 files changed

Lines changed: 12 additions & 11 deletions

File tree

CoreDataUtil/MFLAppDelegate.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ - (BOOL) openFileHelper: (NSString*) filename {
9797
if (result)
9898
{
9999
[self addRecentDocument:[NSURL fileURLWithPath:filename]];
100-
self.projectHasChanged = true;
100+
self.projectHasChanged = NO;
101101
}
102102

103103
return result;
@@ -128,7 +128,7 @@ - (BOOL) openFileHelper: (NSString*) filename {
128128
if (result)
129129
{
130130
[self addRecentDocument:[NSURL fileURLWithPath:filename]];
131-
self.projectHasChanged = true;
131+
self.projectHasChanged = YES;
132132
}
133133
}
134134

@@ -148,6 +148,8 @@ - (BOOL) openFileHelper: (NSString*) filename {
148148
if (project == nil) {
149149
NSBeep();
150150
return NO;
151+
} else {
152+
self.projectHasChanged = NO;
151153
}
152154

153155
self.openFileSheetController = [[OpenFileSheetController alloc] initWithWindowNibName:@"OpenFileSheetController"];
@@ -166,7 +168,7 @@ - (BOOL) openFileHelper: (NSString*) filename {
166168
if (result)
167169
{
168170
[self addRecentDocument:[NSURL fileURLWithPath:filename]];
169-
self.projectHasChanged = true;
171+
self.projectHasChanged = YES;
170172
}
171173
}
172174

@@ -200,7 +202,7 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
200202
[self openFileHelper:[documents[0] path]];
201203
if ([[documents[0] absoluteString] hasSuffix:MFL_COREDATA_PROJECT_EXTENSION])
202204
{
203-
self.projectHasChanged = false;
205+
self.projectHasChanged = NO;
204206
}
205207
}
206208
else
@@ -289,7 +291,7 @@ - (void)handleLaunchArguments:(NSArray *)launchArguments
289291
BOOL result = [self.mainWindowController openFiles:model persistenceFile:store persistenceType:(NSInteger)storeFormat];
290292

291293
if (result) {
292-
self.projectHasChanged = true;
294+
self.projectHasChanged = YES;
293295
}
294296
}
295297
}
@@ -344,7 +346,7 @@ - (IBAction)newAction:(id)sender
344346
BOOL result = [self.mainWindowController openFiles:newValues[MFL_MOM_FILE_KEY] persistenceFile:newValues[MFL_DB_FILE_KEY] persistenceType:[persistenceFormat intValue]];
345347

346348
if (result) {
347-
self.projectHasChanged = true;
349+
self.projectHasChanged = YES;
348350
}
349351
}
350352
}

CoreDataUtil/MFLMainWindowController.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,11 @@ - (void)configureOutlineViewNodes {
648648
[self.rootNode addChild:entitiesNode];
649649

650650
NSUInteger entityCount = self.coreDataIntrospection.entityCount;
651-
for(NSUInteger i=0; i<entityCount; i++) {
651+
for(int i=0; i<entityCount; i++) {
652652
OutlineViewNode *node = [OutlineViewNode new];
653653
node.title = [self.coreDataIntrospection entityAtIndex:i];
654654
node.index = i;
655-
node.badgeValue = [self.coreDataIntrospection entityDataCountAtIndex:i];
655+
node.badgeValue = (int)[self.coreDataIntrospection entityDataCountAtIndex:i];
656656
[entitiesNode addChild:node];
657657
}
658658

@@ -661,7 +661,7 @@ - (void)configureOutlineViewNodes {
661661
fetchRequestNode.index = 1;
662662
[self.rootNode addChild:fetchRequestNode];
663663

664-
for(NSUInteger i=0; i<self.coreDataIntrospection.fetchRequestCount; i++) {
664+
for(int i=0; i<self.coreDataIntrospection.fetchRequestCount; i++) {
665665
OutlineViewNode *node = [OutlineViewNode new];
666666
node.title = [self.coreDataIntrospection fetchRequestAtIndex:i];
667667
node.index = i;

CoreDataUtil/Utils/MFLCoreDataEditorProjectLoader.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ - (NSArray*) executeFetchRequest:(NSManagedObjectContext*) managedObjectContext
2828
}
2929

3030
- (NSDictionary*) decodeProjectFile: (NSString*) projectFilePath {
31-
NSLog(@"TODO: decode core data editor project file...");
32-
31+
3332
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"CoreData" withExtension:@"ext"];
3433
NSManagedObjectModel* managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
3534
if (!managedObjectModel) {

0 commit comments

Comments
 (0)