String exportFileName = page.getExportFileName();
try
{
// Creating the ZipOutputStream
ZipOutputStream zos = new ZipOutputStream( new FileOutputStream( new File( exportFileName ) ) );
// Writing the Connections file.
zos.putNextEntry( new ZipEntry( Messages.getString( "ExportConnectionsWizard.1" ) ) ); //$NON-NLS-1$
Connection[] connections = ConnectionCorePlugin.getDefault().getConnectionManager().getConnections();
Set<ConnectionParameter> connectionParameters = new HashSet<ConnectionParameter>();
for ( Connection connection : connections )
{
connectionParameters.add( connection.getConnectionParameter() );
}
ConnectionIO.save( connectionParameters, zos );
zos.closeEntry();
// Writing the Connection Folders file.
zos.putNextEntry( new ZipEntry( Messages.getString( "ExportConnectionsWizard.2" ) ) ); //$NON-NLS-1$
ConnectionFolder[] connectionFolders = ConnectionCorePlugin.getDefault().getConnectionFolderManager()
.getConnectionFolders();
Set<ConnectionFolder> connectionFoldersSet = new HashSet<ConnectionFolder>();
for ( ConnectionFolder connectionFolder : connectionFolders )
{
connectionFoldersSet.add( connectionFolder );
}
ConnectionIO.saveConnectionFolders( connectionFoldersSet, zos );
zos.closeEntry();
// Writing the Browser Connections file.
zos.putNextEntry( new ZipEntry( Messages.getString( "ExportConnectionsWizard.3" ) ) ); //$NON-NLS-1$
IBrowserConnection[] browserConnections = BrowserCorePlugin.getDefault().getConnectionManager()
.getBrowserConnections();
Map<String, IBrowserConnection> browserConnectionsMap = new HashMap<String, IBrowserConnection>();
for ( IBrowserConnection browserConnection : browserConnections )
{
browserConnectionsMap.put( browserConnection.getConnection().getId(), browserConnection );
}
BrowserConnectionIO.save( zos, browserConnectionsMap );
zos.closeEntry();
// Closing the ZipOutputStream
zos.close();
}
catch ( FileNotFoundException e )
{
// TODO Auto-generated catch block
e.printStackTrace();