message: add Model Export overlay
diff: @@ -14,14 +14,17 @@ import { zip } from '../../mol-util/zip/zip';
  export async function exportHierarchy(plugin: PluginContext, options?: { format?: 'cif' | 'bcif' }) {
  try {
  - await _exportHierarchy(plugin, options);
  + await plugin.runTask(_exportHierarchy(plugin, options), { useOverlay: true });
  } catch (e) {
  console.error(e);
  plugin.log.error(`Model export failed. See console for details.`);
  }
  }
  -async function _exportHierarchy(plugin: PluginContext, options?: { format?: 'cif' | 'bcif' }) {
  +function _exportHierarchy(plugin: PluginContext, options?: { format?: 'cif' | 'bcif' }) {
  + return Task.create('Export', async ctx => {
  + await ctx.update({ message: 'Exporting...', isIndeterminate: true, canAbort: false });
  +
  const format = options?.format ?? 'cif';
  const { structures } = plugin.managers.structure.hierarchy.current;
  @@ -40,6 +43,13 @@ async function _exportHierarchy(plugin: PluginContext, options?: { format?: 'cif
  ? `${s.model.entryId}_${entryMap.get(s.model.entryId)! + 1}.${format}`
  : `${s.model.entryId}.${format}`;
  entryMap.set(s.model.entryId, (entryMap.get(s.model.entryId) ?? 0) + 1);
  +
  + await ctx.update({ message: `Exporting ${s.model.entryId}...`, isIndeterminate: true, canAbort: false });
  + if (s.elementCount > 100000) {
  + // Give UI chance to update, only needed for larger structures.
  + await new Promise(res => setTimeout(res, 50));
  + }
  +
  files.push([name, to_mmCIF(s.model.entryId, s, format === 'bcif', { copyAllCategories: true })]);
  }
  @@ -56,10 +66,11 @@ async function _exportHierarchy(plugin: PluginContext, options?: { format?: 'cif
  zipData[fn] = bytes;
  }
  }
  - const task = Task.create('Export Models', async ctx => {
  - return zip(ctx, zipData);
  - });
  - const buffer = await plugin.runTask(task);
  + await ctx.update({ message: `Compressing Data...`, isIndeterminate: true, canAbort: false });
  + const buffer = await zip(ctx, zipData);
  download(new Blob([new Uint8Array(buffer, 0, buffer.byteLength)]), `structures_${getFormattedTime()}.zip`);
  }
  +
  + plugin.log.info(`[Export] Done.`);
  + });
  }
  \ No newline at end of file
  