String clientID = WorkspaceConfiguration.getDiscreteWorkspaceID(DEFAULT_WORKSPACE_CLIENT_ID);
GemCutter.this.workspaceManager = WorkspaceManager.getWorkspaceManager(clientID);
initWorkspace(nextWorkspaceDeclarationStreamProvider);
final CALWorkspace workspace = workspaceManager.getWorkspace();
// Find number of modules to be loaded and pass this information to progress bar
int nModules = workspace.getModuleNames().length;
gemCutterSplashScreen.setProgressBarMaxValue(nModules);
// Compile specified module or all modules in workspace
long compileStartTime = System.currentTimeMillis();
boolean foundErrors = compileWorkspace(false);
final String statusMessage;
if (!foundErrors) {
statusMessage = GemCutterMessages.getString("SM_RecompilationFinished", Double.toString((System.currentTimeMillis() - compileStartTime)/1000.0));
} else {
statusMessage = GemCutterMessages.getString("SM_RecompilationErrors");
}
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
statusMessageManager.displayMessage(this, statusMessage, StatusMessageDisplayer.MessageType.TRANSIENT, true);
// The new working module, if any.
ModuleName newWorkingModuleName;
// Change to the preferred working module if it's not the current module, and it exists.
if (preferredWorkingModuleName != null && workspace.getMetaModule(preferredWorkingModuleName) != null) {
newWorkingModuleName = preferredWorkingModuleName;
} else {
newWorkingModuleName = getInitialWorkingModuleName(workspace);
}
// Create the perspective
MetaModule initialWorkingModule = workspace.getMetaModule(newWorkingModuleName);
perspective = new Perspective(workspace, initialWorkingModule);
// Clear the TableTop before resetting the runners, so that value editors can be closed
// by the original ValueEditorHierarchyManager.
newTableTop();