public void showMessageBox2(String sTitle, String sMessage){
XComponent xComponent = null;
try {
Object oToolkit = m_xContext.getServiceManager().createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext);
XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(XToolkit.class, oToolkit);
XMessageBoxFactory xMessageBoxFactory = (XMessageBoxFactory)UnoRuntime.queryInterface(XMessageBoxFactory.class, oToolkit);
if ( m_xFrame != null && xToolkit != null ) {
WindowDescriptor aDescriptor = new WindowDescriptor();
aDescriptor.Type = WindowClass.MODALTOP;
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = (XWindowPeer)UnoRuntime.queryInterface(XWindowPeer.class, m_xFrame.getContainerWindow());
XWindowPeer xPeer = xToolkit.createWindow( aDescriptor );
if ( null != xPeer ) {
// rectangle may be empty if position is in the center of the parent peer
Rectangle aRectangle = new Rectangle();
XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox( xPeer, aRectangle, "messbox", com.sun.star.awt.MessageBoxButtons.BUTTONS_OK_CANCEL, sTitle, sMessage);
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xMessageBox);
if (xMessageBox != null){
m_xControlDialogWindow.setEnable(false);
m_iInfoBoxOk = xMessageBox.execute();
m_xControlDialogWindow.setEnable(true);