if(!officeApplication.isActive()) {
NOAUIPlugin.startLocalOfficeApplication(getShell(), officeApplication);
}
if(officeApplication.isActive()) {
INewDocumentRequest newDocumentRequest = getNewDocumentRequest();
ConstructNewDocumentOperation constructNewDocumentOperation = new ConstructNewDocumentOperation(officeApplication,
newDocumentRequest);
try {
getContainer().run(true, true, constructNewDocumentOperation);
}
catch(InterruptedException interruptedException) {
//do not consume
return false;
}
catch(InvocationTargetException invocationTargetException) {
Throwable cause = invocationTargetException.getCause();
ErrorDialog.openError(getShell(), Messages.AbstractNewDocumentWizard_dialog_error_title, cause.getMessage(),
new Status(IStatus.ERROR, EditorUIPlugin.PLUGIN_ID, IStatus.ERROR, cause.getMessage(), cause));
}
final IFile file = constructNewDocumentOperation.getDocumentFile();
if(file != null) {
try {
IDE.openEditor(EditorUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(), file);
}
catch(CoreException coreException) {