Re: Core Data and Document Packages
Re: Core Data and Document Packages
- Subject: Re: Core Data and Document Packages
- From: Tim Perrett <email@hidden>
- Date: Fri, 13 Jul 2007 17:11:16 +0100
Sure, i should have remembered that! lol
With a bit of jiggery pokey I managed to get it working correctly -
you might want to make a few amends to your blog post however (or
probably blog again with the finished and polished code)
For instance, the def noteNewRecentDocumentURL method should look
like this:
def noteNewRecentDocumentURL(url)
packageURL = packageURLFromDataStoreURL(url)
super_noteNewRecentDocumentURL(packageURL)
end
Seeing the finished code in one place would probably be most useful
for other who've been following this thread
All the best sergio - you've done really working this out :)
You might want to post this onto the rubycocoa-talk list too, as the
guys on there would be really interested in this
Tim
On 13 Jul 2007, at 13:45, sergio wrote:
in ruby string manipulation is the most straightforward way to
accomplish what is needed.
class MyDocumentController < OSX::NSDocumentController
def init
super_init
end
def packageURLFromDataStoreURL(url)
OSX::NSURL.fileURLWithPath(url.relativePath.gsub(/data.xml$/, ''))
end
def noteNewRecentDocumentURL(url)
super_noteNewRecentDocumentURL(packageURLFromDataStoreURL(url))
end
end
you'll also need to fix the window title (or else it will always show
"data.xml"). there are several ways to do that. I think that the
correct
one is subclassing NSWindowController, but overriding
NSDocument#displayName will do as well. here the second approach is
shown.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden