Fix SDK examples

Change-Id: I0a3153bc3fa8338a1a0865db2fbe65a56ae064a4
This commit is contained in:
Stephan Bergmann
2012-12-11 18:05:45 +01:00
parent 1b6598c9e7
commit 693332c0b4
8 changed files with 68 additions and 80 deletions

View File

@ -203,35 +203,31 @@ public class ProtocolHandlerAddon {
}
public void showMessageBox(String sTitle, String sMessage) {
try {
if ( null != m_xFrame && null != m_xToolkit ) {
if ( null != m_xFrame && null != m_xToolkit ) {
// describe window properties.
WindowDescriptor aDescriptor = new WindowDescriptor();
aDescriptor.Type = WindowClass.MODALTOP;
aDescriptor.WindowServiceName = new String( "infobox" );
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = (XWindowPeer)UnoRuntime.queryInterface(
XWindowPeer.class, m_xFrame.getContainerWindow());
aDescriptor.Bounds = new Rectangle(0,0,300,200);
aDescriptor.WindowAttributes = WindowAttribute.BORDER |
WindowAttribute.MOVEABLE |
WindowAttribute.CLOSEABLE;
// describe window properties.
WindowDescriptor aDescriptor = new WindowDescriptor();
aDescriptor.Type = WindowClass.MODALTOP;
aDescriptor.WindowServiceName = new String( "infobox" );
aDescriptor.ParentIndex = -1;
aDescriptor.Parent = (XWindowPeer)UnoRuntime.queryInterface(
XWindowPeer.class, m_xFrame.getContainerWindow());
aDescriptor.Bounds = new Rectangle(0,0,300,200);
aDescriptor.WindowAttributes = WindowAttribute.BORDER |
WindowAttribute.MOVEABLE |
WindowAttribute.CLOSEABLE;
XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
if ( null != xPeer ) {
XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
XMessageBox.class, xPeer);
if ( null != xMsgBox )
{
xMsgBox.setCaptionText( sTitle );
xMsgBox.setMessageText( sMessage );
xMsgBox.execute();
}
XWindowPeer xPeer = m_xToolkit.createWindow( aDescriptor );
if ( null != xPeer ) {
XMessageBox xMsgBox = (XMessageBox)UnoRuntime.queryInterface(
XMessageBox.class, xPeer);
if ( null != xMsgBox )
{
xMsgBox.setCaptionText( sTitle );
xMsgBox.setMessageText( sMessage );
xMsgBox.execute();
}
}
} catch ( com.sun.star.uno.Exception e) {
// do your error handling
}
}
}