> Next, this is a non-standard -- and incorrect-looking -- way to create a 
> NSPersistentDocument. Is there a reason you're not using a 
> NSDocumentController method (such as 'openUntitledDocumentAndDisplay:error:') 
> to create it?

I don't want my user to work with a non-saved document. Ever. For a good reason 
: since you need a saved document to use the 
mergeChangesFromContextDidSaveNotification method from NSManagedObjectContext, 
I don't have other choice than have my user always work with a saved document. 
That's unfortunately the only solution I've found to be able to use 
mergeChangesFromContextDidSaveNotification and conform to the 
"NSManagedObjectContrext is a scratchpad" concept.

> Also, the file type you're specifying doesn't look likely. "SQLite" looks 
> like a store type, not a file type, and the store type isn't specified this 
> way.

You're probably right. But I don't know what is the file type of my document. 
I've searched everywhere in the plist and I didn't find any mention of "file 
type".

> Finally, you're turning the usual mechanism inside out by *first* running the 
> save panel yourself, then creating a new document, then trying to save the 
> document but *suppressing* the save panel that would normally appear because 
> the document is new. Is there a reason for that?

I'd like to have the save panel open as a sheet, not a modal window. And the 
standard behavior open a modal window. Is there a way to customize this ?



Thanks for your help,


Eric.

Le 11 nov. 2009 à 19:01, Quincey Morris a écrit :

> On Nov 11, 2009, at 04:34, Eric Morand wrote:
> 
>> - (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode 
>> contextInfo:(void *)contextInfo {
>>      if (returnCode == NSOKButton) {
>>              NSPersistentDocument * newDoc = [[[NSPersistentDocument alloc] 
>> init] autorelease];
>>              
>>              [newDoc setFileType:@"SQLite"];
>>              [newDoc setFileURL:[sheet URL]];
>>              [newDoc saveDocument:self];
>>      }
>>      
>>      [sheet orderOut:self];
>> }
> 
> Seems like you're abusing NSPersistentDocument.
> 
> For a start, it seems likely you want to subclass it, not create an instance 
> of it. Most documents have some kind of transient state, or method overrides, 
> that require a subclass. It's prima facie possible that your documents don't, 
> so perhaps it's OK, but it's certainly unusual.
> 
> Next, this is a non-standard -- and incorrect-looking -- way to create a 
> NSPersistentDocument. Is there a reason you're not using a 
> NSDocumentController method (such as 'openUntitledDocumentAndDisplay:error:') 
> to create it?
> 
> Also, the file type you're specifying doesn't look likely. "SQLite" looks 
> like a store type, not a file type, and the store type isn't specified this 
> way.
> 
> Finally, you're turning the usual mechanism inside out by *first* running the 
> save panel yourself, then creating a new document, then trying to save the 
> document but *suppressing* the save panel that would normally appear because 
> the document is new. Is there a reason for that?
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/eric.morand%40me.com
> 
> This email sent to eric.mor...@me.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to