Many thanks for the answers to my first query. I've incorporated
the 1.1 thread code that GG provided for MRJQuitHandling and at
least it hasn't bust anything.
My second query regards document icons (not the application icon,
which I've added OK with jarbundler). I have a set of icons for
different documents created by my app, each with a different 4-
letter file type (together with my Apple-assigned creator type). I
learned how to assign these on OS 9 using ResEdit, but I'm having
difficulty finding how to do this on OS X - I've searched on the
developer site, but it must be buried in a 100-page document
somewhere. Could anyone give me a pointer here?
OS X provides an information property list (Info.plist file) that
controls many aspects of your apps behavior; including registration
of document-types your app supports. XCode provides an interface for
editing you app's Info.plist file.
I tried this with XCode's Java Swing sample app and it works.
1) Create a Java Swing project
2) Build it. This step checks that the supplied template is working;
there's no trick here.
3) Open the Targets item by clicking on the triangle.
4) You should see a target with your app's name; double-click it. You
should get a window with your project settings displayed in a tree
5) Look down the list and you'll see an 'Info.plist Entries' item.
Beneath that is 'Simple Information' with a list of sub-items like
'Basic Information' etc...
6) Find the entry called 'Document Types' and click on it.
7) You should be looking at a table with columns named 'Name',
'Role', 'Extensions', etc ... This is where you enter information
about the document types your app supports.
8) Click on the plus sign beneath the table and then you can enter
the name of your document. Here's an example:
Extensions: sdoc (Note: no period used here)
MIME Types: (I left this blank)
OS Types: (I left this blank)
Icon File: I used a .icns file. Add your icns file to your
project by drag-and-drop or import. Then drag and drop into the icon
file edit-box on this form. When your icns file is loaded correctly
XCode will display a sample icon from your file.
Document Class: (I left this blank. NSDocument-based apps use this
entry for the sub-class that handles this document type.)
9) Rebuild your project.
10) Run your app. When you run your app, your app's Info.plist is
read and your document types registered with Launch Services. The
icons and file-types for your documents are registered for you on
11) Relaunch Finder. Use 'Force Quit' from the apple menu-item top-
left of your desktop. Select Finder and relaunch it. This ensures
Finder re-reads any cached information about file-types and icons;
12) Test your registered file-types. I created a file called
'testfile.unknown' and, from Finder, renamed it to testfile.sdoc.
Finder redisplayed my file with the icon I provided in my .icns file.
Double-click your testfile; you should see your app launched for you.
There are, of course associated issues, such as how to check that
I've assigned file and creator types correctly in java (I see the
old code is not supported, and I'm not sure my new code is
working), whether double-clicking on a properly created document
will launch the app as it does on OS 9 (I read that initially that
wasn't supported in OS X - is it now?) and whether I can drag a
document onto the app icon to open it (I never could on OS 9, but
if I drag OS 9 docs on the OS X app there is an attempt to launch
Another good test is to open your app's bundle. From Finder select
your app and control-click. Select 'Show Package Contents'. You
should see a Finder window with a folder called contents; double-
click it. You should see a file called Info.plist; Double-click it.
If you have XCode installed any .plist file will open in Property
From Property List Editor navigate from Root and expand the
CFBundleDocumentTypes item. You should see a list of dictionaries,
one for each document-type you registered. Expand one and check the
entries contain the extensions and icon files you specified.
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden