@Override
	public void removeWorkspace(Workspace ws) {
		// this is a programming error if it occurs
		if (!workspaces.contains(ws)) {
			Msg.showError(this, null, null, null,
				new RuntimeException("unknown/stale workspace reference: " + ws));
		}

		// first close all the tools running in the workspace
		// and if any of the tools don't close, don't remove the workspace
		PluginTool[] runningTools = ws.getTools();
		for (PluginTool runningTool : runningTools) {
			// if data has changed in the tool, the frontEnd will take care
			// of asking/confirming saving tool
			runningTool.close();
		}

		// if any of the tools didn't close, don't remove the workspace
		runningTools = ws.getTools();
		if (runningTools.length > 0) {
			return;
		}

		// remove workspace from list of workspaces
		String wsName = ws.getName();
		workspaces.remove(ws);
		wsMap.remove(wsName);

		// notify listeners of removed workspace
		for (WorkspaceChangeListener listener : changeListeners) {
			listener.workspaceRemoved(ws);
		}

		// set the oldest workspace to now be the active workspace;
		// if this is the last workspace, then create a new "empty"
		// workspace which is the project default
		if (workspaces.size() == 0) {
			try {
				createWorkspace(DEFAULT_WORKSPACE_NAME);
			}
			catch (DuplicateNameException e) {
				Msg.showError(this, null, "Duplicate Name",
					"Error Creating Default Workspace: " + e.getMessage());
			}
		}
		else {

			Workspace workspace = workspaces.get(0);
			workspace.setActive();
		}
	}
Registers the new instance of the tool in the namesMap and returns the total number of
running instances of that tool
@param toolName the name of the tool being registers
@param tool the tool being registered
Ghidra/Framework/Project/src/main/java/ghidra/framework/project/tool/ToolManagerImpl.java