• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Saving Plug-in Data into Document?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saving Plug-in Data into Document?


  • Subject: Saving Plug-in Data into Document?
  • From: Stephen Magyari <email@hidden>
  • Date: Mon, 22 Sep 2003 21:13:50 -0700

I'm working on the requirements for a multiple-document based application
and would like to use plug-ins as a way to provide & extend the kind of data
that will be saved in the document.

I've gone through the archives and Developer Docs, perused various 'net
resources & Obj-C OS X programming books (Building Cocoa Applications, Cocoa
Programming, Cocoa Programming for OS X, etc..), and read Rainer
Brokerhoff's (quite excellent) paper on using plug-ins at
http://cocoadevcentral.com/articles/000068.php.

I think I have a fairly decent grasp of what I'm after, but want to do a
sanity check with more experienced folks as I'm not sure I'm on the right
track.

Here's the gist of my understanding -- The app itself would primarily play a
traffic-cop role, and each plug-in would:
1) conform to a formal protocol for managing it's own (and adhering to
application-wide) preferences, hooking into the app itself, etc..
2) define & implement it's own data source
3) have (potentially) multiple windows / views to display & handle printing
its own data
4) (potentially) be able to link / "cross-reference" data handled by
another plug-in
5) other considerations I'm sure I haven't thought of yet

The part I'm struggling with (conceptually) is this -- if each plug-in
manages its own data source (that the host application has no specific
knowledge of), how do I get each plug-in's data saved into one document?

My thought was to use an enumerator in the document's
dataRepresentationOfType and loadDataRepresentation methods to send each
plug-in instance (stored in an array when the app loads) a corresponding
message / method (implemented in the formal protocol) to encode / decode
it's object(s) to / from an NSDictionary that would then be used in the
dataRepresentation methods for saving / opening a document.

Then I thought that maybe it'd be better to limit the data sources to being
defined in the main application, and let the plug-ins handle the
display/view/printing and manipulation only -- but then how would the
plug-ins know what data is available? (Could I just have them import a
relevant header file?)

Then I got confused.

At the root of it, I have 4 questions:
1) is saving multiple plug-ins' specific data into one document possible?
If so, am I on the right track with the enumerator & NSDictionary approach?

2) Which is the better / more correct approach?
a. Having the plug-ins manage the data and display of that data?
b. Having the app manage the data while the plug-ins manage the
display?
c. Skip the idea of plug-ins and hard wire everything into one
application?

3) Is there a better / more correct approach I haven't realized?

4) What am I missing?

Thanks for any input / assistance you might be able to provide.

Regards,
Stephen M.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Using NSArchiver with NSDocument follow-up
  • Next by Date: NotificationCenter, NSConnection, distributed notifications
  • Previous by thread: remote variables
  • Next by thread: NotificationCenter, NSConnection, distributed notifications
  • Index(es):
    • Date
    • Thread