}
//get URL of document if possible
URL documentURL = getURLFromEditorInput(editorInput);
DocumentDescriptor documentDescriptor = new DocumentDescriptor();
documentDescriptor.setTitle(editorInput.getName());
if(documentURL != null) {
documentDescriptor.setURL(documentURL.toString());
documentDescriptor.setBaseURL(documentURL.toString());
}
isSaveAsAllowed = true;
InputStream inputStream = null;
LoadDocumentOperation loadTextDocumentOperation = null;
//Load document with input stream if it is not a base document
if(!isBaseDocumentURL(documentURL) && editorInput instanceof IStorageEditorInput) {
IStorageEditorInput storageEditorInput = (IStorageEditorInput)editorInput;
boolean readOnly = false;
IStorage storage = storageEditorInput.getStorage();
if(storage == null || storage.isReadOnly())
readOnly = true;
documentDescriptor.setReadOnly(readOnly);
inputStream = storageEditorInput.getStorage().getContents();
if(documentURL != null && documentURL.getFile().endsWith(".xml")) { //$NON-NLS-1$
setXMLLoadFilter(composite.getShell(),documentDescriptor);
}
loadTextDocumentOperation = new LoadDocumentOperation(null, officeApplication, officeFrame, inputStream, documentDescriptor);