def generate(self, tool, copied=False, copy=False):
        tools = []
        if not tool:
            logger.info("Workspace supports one tool for all projects within.")
            return -1
        else:
            tools = [tool]
        result = 0
        for export_tool in tools:
            tool_export = ToolsSupported().get_tool(export_tool)
            if tool_export is None:
                result = -1
                continue
            project_export_dir_overwrite = False
            if self.settings.export_location_format != self.settings.DEFAULT_EXPORT_LOCATION_FORMAT:
                location_format = self.settings.export_location_format
            else:
                if 'export_dir' in self.workspace_settings:
                    location_format = self.workspace_settings['export_dir'][0]
                    project_export_dir_overwrite = True
                else:
                    location_format = self.settings.export_location_format
            location = PartialFormatter().format(location_format, **{
                'project_name': self.name,
                'tool': tool,
                'workspace_name': self.name
            })
            workspace_dic = {
                'projects': [],
                'settings': {
                    'name': self.name,
                    'path': os.path.normpath(location),
                },
            }
            for project in self.projects:
                generated_files = {
                    'projects' : [],
                    'workspaces': [],
                }
                if project_export_dir_overwrite:
                    project.project['common']['export_dir'] = location
                project._fill_export_dict(export_tool, copied)
                if copy:
                    project._copy_sources_to_generated_destination()
                project.project['export']['singular'] = False
                files = tool_export(project.project['export'], self.settings).export_project()
                workspace_dic['projects'].append(files)
                generated_files['projects'].append(files)
            generated_files['workspaces'] = tool_export(workspace_dic, self.settings).export_workspace()
            self.generated_files[export_tool] = generated_files
            return result