* @param file
* @return the Element
*/
public Element previewFile(IFile file) {
IDOMModel xmlModel = null;
DocumentPageVariableAdapter provider = null;
boolean pushedPageVarProvider = false;
try {
xmlModel = (IDOMModel) StructuredModelManager.getModelManager().getModelForRead(
file);
if (xmlModel != null) {
IDOMDocument doc = xmlModel.getDocument();
// XXX: need to also register page variable adapters. In the
// future, this should go to some
// SSE system registry mechanism.
xmlModel.getFactoryRegistry().addFactory(
new PageVariableAdapterFactory());
provider = new DocumentPageVariableAdapter(doc);
doc.addAdapter(provider);
provider.refresh();
PageExpressionContext.getCurrent()
.pushPageVarProvider(provider);
Node child = xmlModel.getDocument().getFirstChild();
PreviewConvertContext context = new PreviewConvertContext(this