firstModule = ModuleName.make(storedModules[0].getName());
} else {
firstModule = null;
}
// Reset the source definition group.
this.sourceDefinitionGroup = new ModuleSourceDefinitionGroup(ModuleSourceDefinition.EMPTY_ARRAY);
// Add new modules..
// Import the stored module resources.
List<StoredVaultElement.Module> storedModulesList = new ArrayList<StoredVaultElement.Module>(Arrays.asList(storedModules));
for (Iterator<StoredVaultElement.Module> it = storedModulesList.iterator(); it.hasNext(); ) {
StoredVaultElement.Module storedModule = it.next();
if (isNullary() && !isTopLevelStoredModuleElementInStandardVault(storedModule) && !isCarBasedStoredModuleElementInStandardVault(storedModule)) {
String warningString = "Module " + storedModule.getName() +
" was not imported. Only Modules from the StandardVault or from a Car file may be used to initialize a nullary workspace.";
initStatus.add(new Status(Status.Severity.WARNING, warningString));
it.remove();
continue;
}
importStoredModule(storedModule, initStatus);
}
// Create the module sources, and the source provider.
ModuleSourceDefinition[] sourceDefinitions = new ModuleSourceDefinition[storedModulesList.size()];
int index = 0;
for (final StoredVaultElement.Module storedModule : storedModulesList) {
ModuleName moduleName = ModuleName.make(storedModule.getName());
CALSourceManager sourceManager = virtualResourceManager.getSourceManager(moduleName);
if (sourceManager == null) {
initStatus.add(new Status(Status.Severity.WARNING, "No registered source manager."));
return initStatus;
}
sourceDefinitions[index] = sourceManager.getSource(moduleName, initStatus);
index++;
}
this.sourceDefinitionGroup = new ModuleSourceDefinitionGroup(sourceDefinitions);
// Persist the workspace description.
if (!isNullary() && sourceDefinitionGroup.getNModules() > 0) {
saveWorkspaceDescription(initStatus);
}