question: public static String canUseFileName ( FileObject targetFolder , String folderName , String newObjectName , String extension ) { String newObjectNameToDisplay = newObjectName ; if ( newObjectName != null ) { newObjectName = newObjectName . replace ( '.' , '/' ) ; } if ( extension != null && extension . length ( ) > 0 ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( newObjectName ) ; sb . append ( '.' ) ; sb . append ( extension ) ; newObjectName = sb . toString ( ) ; } if ( extension != null && extension . length ( ) > 0 ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( newObjectNameToDisplay ) ; sb . append ( '.' ) ; sb . append ( extension ) ; newObjectNameToDisplay = sb . toString ( ) ; } String relFileName = folderName + "/" + newObjectName ; if ( targetFolder == null || ! targetFolder . isValid ( ) ) { return NbBundle . getMessage ( TargetChooserPanel . class , "MSG_fs_or_folder_does_not_exist" ) ; } File targetPackage = folderName != null ? new File ( FileUtil . toFile ( targetFolder ) , folderName ) : FileUtil . toFile ( targetFolder ) ; if ( targetPackage != null ) { if ( targetPackage . exists ( ) && ! targetPackage . canWrite ( ) ) { return NbBundle . getMessage ( TargetChooserPanel . class , "MSG_fs_is_readonly" ) ; } } else if ( ! targetFolder . canWrite ( ) ) { return NbBundle . getMessage ( TargetChooserPanel . class , "MSG_fs_is_readonly" ) ; } if ( existFileName ( targetFolder , relFileName ) ) { return NbBundle . getMessage ( TargetChooserPanel . class , "MSG_file_already_exist" , newObjectNameToDisplay ) ; } return null ; }
target:  Checks if the given file name can be created in the target folder.