Buggy code:
static final char EXTENSION_SEPARATOR = ';' ; public FileDialog ( Shell parent ) { } public FileDialog ( Shell parent , int style ) { } public String getFileName ( ) { } public String [ ] getFileNames ( ) { } public String [ ] getFilterExtensions ( ) { } public int getFilterIndex ( ) { } public String [ ] getFilterNames ( ) { } public String getFilterPath ( ) { } public boolean getOverwrite ( ) { } public String open ( ) { String fullPath = null ; fileNames = new String [ 0 ] ; int method = 0 ; int methodImpl = 0 ; Callback callback = null ; if ( ( ( style ) & ( SWT . SAVE ) ) != 0 ) { NSSavePanel savePanel = NSSavePanel . savePanel ( ) ; panel = savePanel ; if ( ! ( overwrite ) ) { callback = new Callback ( this , "_overwriteExistingFileCheck" , 3 ) ; int proc = callback . getAddress ( ) ; if ( proc == 0 ) error ( ERROR_NO_MORE_CALLBACKS ) ; method = OS . class_getInstanceMethod ( class_NSSavePanel , sel_overwriteExistingFileCheck ) ; if ( method != 0 ) methodImpl = OS . method_setImplementation ( method , proc ) ; } } else { NSOpenPanel openPanel = NSOpenPanel . openPanel ( ) ; openPanel . setAllowsMultipleSelection ( ( ( ( style ) & ( SWT . MULTI ) ) != 0 ) ) ; panel = openPanel ; } panel . setCanCreateDirectories ( true ) ; OS . objc_msgSend ( panel . id , sel_setShowsHiddenFiles_ , true ) ; int jniRef = 0 ; SWTPanelDelegate delegate = null ; if ( ( ( filterExtensions ) != null ) && ( ( filterExtensions . length ) != 0 ) ) { delegate = ( ( SWTPanelDelegate ) ( new SWTPanelDelegate ( ) . alloc ( ) . init ( ) ) ) ; jniRef = OS . NewGlobalRef ( this ) ; if ( jniRef == 0 ) SWT . error ( ERROR_NO_HANDLES ) ; OS . object_setInstanceVariable ( delegate . id , SWT_OBJECT , jniRef ) ; panel . setDelegate ( delegate ) ; NSPopUpButton widget = ( ( NSPopUpButton ) ( new NSPopUpButton ( ) . alloc ( ) ) ) ; widget . initWithFrame ( new NSRect ( ) , false ) ; widget . setTarget ( delegate ) ; widget . setAction ( sel_sendSelection_ ) ; NSMenu menu = widget . menu ( ) ; menu . setAutoenablesItems ( false ) ; for ( int i = 0 ; i < ( filterExtensions . length ) ; i ++ ) { String str = filterExtensions [ i ] ; if ( ( ( filterNames ) != null ) && ( ( filterNames . length ) > i ) ) { str = filterNames [ i ] ; } NSMenuItem nsItem = ( ( NSMenuItem ) ( new NSMenuItem ( ) . alloc ( ) ) ) ; nsItem . initWithTitle ( NSString . stringWith ( str ) , 0 , NSString . string ( ) ) ; menu . addItem ( nsItem ) ; nsItem . release ( ) ; } widget . selectItemAtIndex ( ( ( 0 <= ( filterIndex ) ) && ( ( filterIndex ) < ( filterExtensions . length ) ) ? filterIndex : 0 ) ) ; widget . sizeToFit ( ) ; panel . setAccessoryView ( widget ) ; popup = widget ; } panel . setTitle ( NSString . stringWith ( ( ( title ) != null ? title : "" ) ) ) ; NSApplication application = NSApplication . sharedApplication ( ) ; if ( ( ( parent ) != null ) && ( ( ( style ) & ( SWT . SHEET ) ) != 0 ) ) { <START_BUG> application . beginSheet ( panel , window , null , 0 , 0 ) ; <END_BUG> } Display display = ( ( parent ) != null ) ? parent . getDisplay ( ) : Display . getCurrent ( ) ; display . setModalDialog ( this ) ; NSString dir = ( ( filterPath ) != null ) ? NSString . stringWith ( filterPath ) : null ; NSString file = ( ( fileName ) != null ) ? NSString . stringWith ( fileName ) : null ; int response = panel . runModalForDirectory ( dir , file ) ; if ( ( ( parent ) != null ) && ( ( ( style ) & ( SWT . SHEET ) ) != 0 ) ) { application . endSheet ( panel , 0 ) ; } display . setModalDialog ( null ) ; if ( ! ( overwrite ) ) { if ( method != 0 ) OS . method_setImplementation ( method , methodImpl ) ; if ( callback != null ) callback . dispose ( ) ; } if ( ( popup ) != null ) { filterIndex = ( ( int ) ( popup . indexOfSelectedItem ( ) ) ) ; } else { filterIndex = - 1 ; } if ( response == ( OS . NSFileHandlingPanelOKButton ) ) { NSString filename = panel . filename ( ) ; if ( ( ( style ) & ( SWT . SAVE ) ) != 0 ) { if ( ( ( filterExtensions ) != null ) && ( ( filterExtensions . length ) != 0 ) ) { if ( ( 0 <= ( filterIndex ) ) && ( ( filterIndex ) < ( filterExtensions . length ) ) ) { NSString ext = filename . pathExtension ( ) ; if ( ( ext == null ) || ( ( ext . length ( ) ) == 0 ) ) { String exts = filterExtensions [ filterIndex ] ; int length = exts . length ( ) ; int index = exts . indexOf ( FileDialog . EXTENSION_SEPARATOR ) ; if ( index == ( - 1 ) ) index = length ;

Fix:
application . beginSheet ( panel , view . window ( ) , null , 0 , 0 ) ;