/** * Executes the program with the file as the single argument in the operating system. It is the * responsibility of the programmer to ensure that the file contains valid data for this program. * * @param fileName the file or program name * @return <code>true</code> if the file is launched, otherwise <code>false</code> * @exception IllegalArgumentException * <ul> * <li>ERROR_NULL_ARGUMENT when fileName is null * </ul> */ public boolean execute(String fileName) { if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); NSAutoreleasePool pool = (NSAutoreleasePool) new NSAutoreleasePool().alloc().init(); try { NSWorkspace workspace = NSWorkspace.sharedWorkspace(); NSURL url = getURL(fileName); NSArray urls = NSArray.arrayWithObject(url); return workspace.openURLs(urls, NSString.stringWith(identifier), 0, null, 0); } finally { pool.release(); } }