* @throws BadPartitioningException if partitioning is invalid for this document
* @since 3.1
*/
private String[] getContentTypes(IDocument document) throws BadPartitioningException {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 ext= (IDocumentExtension3) document;
String[] partitionings= ext.getPartitionings();
Set contentTypes= new HashSet(20);
for (int i= 0; i < partitionings.length; i++) {
contentTypes.addAll(Arrays.asList(ext.getLegalContentTypes(partitionings[i])));
}
contentTypes.add(IDocument.DEFAULT_CONTENT_TYPE);
return (String[]) contentTypes.toArray(new String[contentTypes.size()]);
}
return document.getLegalContentTypes();