Download: ODBEditor.tgz

Last updated: Nov 30, 2004 with some patches from Eric Blair and Gus Mueller.

The ODB Editor Suite is "an Apple Event-based interface that developers may take advantage of in order to provide better integration between their products and BBEdit". The classes included here make it easy to do just that. You can send strings to BBEdit through these classes, and in turn BBEdit will let you know when they have been updated or changed.

Although I wasn't the original author of these classes, I now maintain them. So if you have any patches, improvements, fixes, ideas, or questions about them, please send me an email: gus@flyingmeat.com

You won't be able to compile the classes without first obtaining the ODBEditorSuite.h file. You can download the most recent copy from Bare Bones' website: http://www.barebones.com/support/develop/odbsuite.shtml

Some implementation notes:

It's pretty easy to call, just use
[[ODBEditor sharedODBEditor] editString: aString options: nil forClient: self context: NULL];
And implement the ODBEditorClient methods (defined in ODBEditor.h) and you'll get sent a message at the appropriate times.

You'll need to assign your application a unique creator code (which is defined in your Info.plist files with the CFBundleSignature key). The example project uses the creator code 'odbE', you'll need to pick another one for your project. Visit http://developer.apple.com/dev/cftype/register.html to register for it.

If you use editString:options:forClient:context:, the temp file is automatically cleaned up.
If you use editFile:options:forClient:context:, the caller is responsible for cleanup.
If you use editString:, the temp file isn't clean up on abort

The ODBEditor class doesn't guard against editing the same piece of data more than once.