IDocumentPartitioner documentPartitioner = structuredDocument.getDocumentPartitioner();
// ISSUE: this logic is flawed, not sure of original intent, but
// added null/type checks for safety.
if (documentPartitioner != null && documentPartitioner instanceof StructuredTextPartitionerForJSP) {
if (newEmbeddedContentType.getFamilyId().equals(ContentTypeIdForXML.ContentTypeID_XML)) {
((StructuredTextPartitionerForJSP) documentPartitioner).setEmbeddedPartitioner(new StructuredTextPartitionerForXML());
}
else if (newEmbeddedContentType.getFamilyId().equals(ContentTypeIdForHTML.ContentTypeID_HTML)) {
((StructuredTextPartitionerForJSP) documentPartitioner).setEmbeddedPartitioner(new StructuredTextPartitionerForHTML());
}
}