class MultipleWorkspacesExporter implements Runnable, LongTask {

        private final Exporter exporter;
        private final FileObject folder;
        private final String extension;
        private boolean cancel = false;
        private ProgressTicket progressTicket;

        public MultipleWorkspacesExporter(Exporter exporter, FileObject folder, String extension) {
            this.exporter = exporter;
            this.folder = folder;
            this.extension = extension.replace(".", "");
        }

        @Override
        public void run() {<FILL_FUNCTION_BODY>}

        @Override
        public boolean cancel() {
            cancel = true;
            return true;
        }

        @Override
        public void setProgressTicket(ProgressTicket progressTicket) {
            this.progressTicket = progressTicket;
        }
    }

            Project project = Lookup.getDefault().lookup(ProjectController.class).getCurrentProject();
            if (project != null) {
                Collection<Workspace> workspaceCollection = project.getWorkspaces();
                Progress.start(progressTicket, workspaceCollection.size());

                for(Workspace workspace :workspaceCollection) {
                    if (cancel) {
                        break;
                    }
                    try {
                        FileObject file;
                        String workspaceName = workspace.getName().replaceAll("[\\\\/:*?\"<>|]", "_");
                        if (folder.getFileObject(workspaceName, extension) == null) {
                            file = folder.createData(workspaceName, extension);
                        } else {
                            // Overwrite
                            file = folder.getFileObject(workspaceName, extension);
                        }
                        String taskmsg = NbBundle.getMessage(DesktopExportController.class, "DesktopExportController.exportTaskName",
                            file.getNameExt());
                        Progress.setDisplayName(progressTicket, taskmsg);

                        exporter.setWorkspace(workspace);
                        controller.exportFile(FileUtil.toFile(file), exporter);
                        Progress.progress(progressTicket);
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
                Progress.finish(progressTicket);

                if(!cancel) {
                    StatusDisplayer.getDefault().setStatusText(NbBundle
                        .getMessage(DesktopExportController.class, "DesktopExportController.status.exportAllSuccess",
                            workspaceCollection.size(), folder.getPath()));
                }
            }
        
<no_super_class>