Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From Classic to X: 3. File types and OpenDocumentHandling



Having produced an Info.plist in which I assign extensions, file types and even MIME types (all text/plain) to the various documents my application works with, I have successfully created files with the correct icons. These files also launch the app from the finder. Thanks again Rob MacGregor for his help.

However in OsX the code I have in my OpenFileHandler method is not handling the file as it should, and it would seem that I am probably not assigning correct file types (even though the code is not throwing exceptions) which is used by my code to determine how to process the files. The icon assignment seems to depend solely on the file extension. Now I could handle the files by their extensions, but I don't like this and would prefer to sort the problem out. Any help would be appreciated.

My code uses MRJApplicationUtils.registerOpenDocumentHandler(), and uses MRJOSType construction. (However it would appear that MRJApplicationUtils.isMRJToolkitAvailable() returns false on OS X Java 1.4.) I wrote code for OSX which uses the methods MRJFileUtils.setFileType(file, type), and MRJFileUtils.setFileCreator(file, creator) which are documented for Java 1.3 somewhere on the Apple Developer site, but I suspect that they may be no longer supported.

Should I be importing com.apple.eawt (I seem to have downloaded a copy of this in AppleJavaExtensions.jar - apparently version 1.2) and using the FileManager methods such as setFileType(java.lang.String filename, int type) ? And if so, don't laugh, how do I represent a file type like TEXT as an integer?

David

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.