}
protected void initEmbeddedTypePre(IStructuredModel model, IStructuredDocument structuredDocument) {
// note: this will currently only work for models backed by files
EmbeddedTypeHandler embeddedContentType = null;
IDOMModel domModel = (IDOMModel) model;
if (embeddedContentType == null) {
IContentDescription desc = getContentDescription(structuredDocument);
if (desc != null) {
Object prop = null;
prop = desc.getProperty(IContentDescriptionForJSP.CONTENT_FAMILY_ATTRIBUTE);
if (prop != null) {
if (ContentTypeFamilyForHTML.HTML_FAMILY.equals(prop)) {
embeddedContentType = EmbeddedTypeRegistryImpl.getInstance().getTypeFor("text/html");
}
}
if (embeddedContentType == null) {
prop = desc.getProperty(IContentDescriptionForJSP.CONTENT_TYPE_ATTRIBUTE);
if (prop != null) {
embeddedContentType = EmbeddedTypeRegistryImpl.getInstance().getTypeFor((String) prop);
}
}
}
}
IDOMDocument document = domModel.getDocument();
PageDirectiveAdapter pageDirectiveAdapter = (PageDirectiveAdapter) document.getAdapterFor(PageDirectiveAdapter.class);
if (embeddedContentType != null) {
pageDirectiveAdapter.setEmbeddedType(embeddedContentType);
embeddedContentType.initializeFactoryRegistry(model.getFactoryRegistry());
}
else {
// use default embeddedType if it couldn't determine one
embeddedContentType = getJSPDefaultEmbeddedType(model);
pageDirectiveAdapter.setEmbeddedType(embeddedContentType);
embeddedContentType.initializeFactoryRegistry(model.getFactoryRegistry());
}
}