IFrame officeFrame = officeAplication.getDesktopService().constructNewOfficeFrame(panel);
officeAplication.getDocumentService().constructNewDocument(officeFrame, IDocument.WRITER, DocumentDescriptor.DEFAULT);
frame.validate();
//Now it is time to disable two commands in the frame
officeFrame.disableDispatch(GlobalCommands.CLOSE_DOCUMENT);
officeFrame.disableDispatch(GlobalCommands.QUIT_APPLICATION);
officeFrame.updateDispatches();
}
catch (Throwable throwable) {
throwable.printStackTrace();