*
* @return all matching content types in the preferred order
* @see IContentTypeManager#findContentTypesFor(String)
*/
public IContentType[][] internalFindContentTypesFor(ContentTypeMatcher matcher, final String fileName, Comparator sortingPolicy) {
IScopeContext context = matcher.getContext();
IContentType[][] result = {NO_CONTENT_TYPES, NO_CONTENT_TYPES};
final Set allByFileName;
if (context.equals(manager.getContext()))
allByFileName = getDirectlyAssociated(fileName, IContentTypeSettings.FILE_NAME_SPEC);
else {
allByFileName = new HashSet(getDirectlyAssociated(fileName, IContentTypeSettings.FILE_NAME_SPEC | IContentType.IGNORE_USER_DEFINED));
allByFileName.addAll(matcher.getDirectlyAssociated(this, fileName, IContentTypeSettings.FILE_NAME_SPEC));
}
Set selectedByName = selectMatchingByName(context, allByFileName, Collections.EMPTY_SET, fileName, IContentType.FILE_NAME_SPEC);
result[0] = (IContentType[]) selectedByName.toArray(new IContentType[selectedByName.size()]);
final String fileExtension = ContentTypeManager.getFileExtension(fileName);
if (fileExtension != null) {
final Set allByFileExtension;
if (context.equals(manager.getContext()))
allByFileExtension = getDirectlyAssociated(fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC);
else {
allByFileExtension = new HashSet(getDirectlyAssociated(fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC | IContentType.IGNORE_USER_DEFINED));
allByFileExtension.addAll(matcher.getDirectlyAssociated(this, fileExtension, IContentTypeSettings.FILE_EXTENSION_SPEC));
}