}
}
// Loading the ConnectionFolders
ZipEntry connectionFoldersEntry = importFile.getEntry( "connectionFolders.xml" ); //$NON-NLS-1$
ConnectionFolder rootConnectionFolder = null;
if ( connectionFoldersEntry != null )
{
InputStream connectionFoldersInputStream = importFile.getInputStream( connectionFoldersEntry );
ConnectionFolderManager connectionFolderManager = ConnectionCorePlugin.getDefault()
.getConnectionFolderManager();
Set<ConnectionFolder> connectionFoldersSet = ConnectionIO
.loadConnectionFolders( connectionFoldersInputStream );
for ( ConnectionFolder connectionFolder : connectionFoldersSet )
{
if ( !"0".equals( connectionFolder.getId() ) ) //$NON-NLS-1$
{
connectionFolderManager.addConnectionFolder( connectionFolder );
}
else
{
rootConnectionFolder = connectionFolder;
}
}
// Root ConnectionFolder must be the last one to be loaded
if ( rootConnectionFolder != null )
{
ConnectionFolder realRootConnectionFolder = connectionFolderManager.getRootConnectionFolder();
// Adding subfolders
List<String> realSubFolderIds = realRootConnectionFolder.getSubFolderIds();
for ( String subFolderId : rootConnectionFolder.getSubFolderIds() )
{
if ( !realSubFolderIds.contains( subFolderId ) )
{
realRootConnectionFolder.addSubFolderId( subFolderId );
}
}
// Adding connections
List<String> realConnectionIds = realRootConnectionFolder.getConnectionIds();
for ( String connectionId : rootConnectionFolder.getConnectionIds() )
{
if ( !realConnectionIds.contains( connectionId ) )
{
realRootConnectionFolder.addConnectionId( connectionId );
}
}
}
}