private boolean extensionValidForContentType ( String fileName ) { boolean valid = false ; IContentType type = getContentType ( ) ; // there is currently an extension if ( fileName . lastIndexOf ( ' ' ) != - 1 ) { // check what content types are associated with current extension IContentType [ ] types = Platform . getContentTypeManager ( ) . findContentTypesFor ( fileName ) ; int i = 0 ; while ( i < types . length && ! valid ) { valid = types [ i ] . isKindOf ( type ) ; ++ i ; } } else valid = true ; // no extension so valid return valid ; }
Verifies if fileName is valid name for content type . Takes base content type into consideration .