XSingleServiceFactory xConnectionFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer );
for ( int i=0; i< m_WikiConnections.size(); i++ )
{
Object oNewConnection = xConnectionFactory.createInstance();
Hashtable ht = ( Hashtable ) m_WikiConnections.get( i );
XNameReplace xNewConn = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewConnection );
if ( xNewConn != null )
xNewConn.replaceByName( "UserName", ht.get( "Username" ) );
xContainer.insertByName( (String)ht.get( "Url" ), xNewConn );
}
// commit changes
XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer );
xBatch.commitChanges();
// remove stored connection information
XNameContainer xContainer2 = Helper.GetConfigNameContainer( m_xContext, "org.openoffice.Office.Custom.WikiExtension/RecentDocs" );
String[] pNames2 = xContainer2.getElementNames();
for( int i=0; i<pNames2.length; i++ )
{
xContainer2.removeByName( pNames2[i] );
}
// store all Docs
XSingleServiceFactory xDocListFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer2 );
for ( int i=0; i< m_aWikiDocs.size(); i++ )
{
Hashtable ht = ( Hashtable ) m_aWikiDocs.get( i );
Object oNewDoc = xDocListFactory.createInstance();
XNameReplace xNewDoc = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewDoc );
Enumeration e = ht.keys();
while ( e.hasMoreElements() )
{
String key = ( String ) e.nextElement();
xNewDoc.replaceByName( key, ht.get( key ) );
}
xContainer2.insertByName( "d" + i, xNewDoc );
}
// commit changes