// get a listener object (probably an adapter) that notifies
// the dialog of external changes to its model
XChangesListener xListener = dialog.createChangesListener( );
XChangesNotifier xNotifier =
(XChangesNotifier)UnoRuntime.queryInterface(XChangesNotifier.class, xViewRoot);
xNotifier.addChangesListener( xListener );
// trigger the listener
changeSomeData( cGridOptionsPath + "/Subdivision" );
if (dialog.execute() == GridOptionsEditor.SAVE_SETTINGS)
{
// changes have been applied to the view here
XChangesBatch xUpdateControl =
(XChangesBatch) UnoRuntime.queryInterface(XChangesBatch.class,xViewRoot);
try
{
xUpdateControl.commitChanges();
}
catch (Exception e)
{
dialog.informUserOfError( e );
}
}
// all changes have been handled - clean up and return
// listener is done now
xNotifier.removeChangesListener( xListener );
// we are done with the view - dispose it
((XComponent)UnoRuntime.queryInterface(XComponent.class, xViewRoot)).dispose();
}