Search in sources :

Example 1 with TaskbarProgressReceiver

use of org.pepsoft.util.TaskbarProgressReceiver in project WorldPainter by Captain-Chaos.

the class ExportProgressDialog method getTask.

@Override
protected ProgressTask<Map<Integer, ChunkFactory.Stats>> getTask() {
    return new ProgressTask<Map<Integer, ChunkFactory.Stats>>() {

        @Override
        public String getName() {
            return "Exporting world " + name;
        }

        @Override
        public Map<Integer, ChunkFactory.Stats> execute(ProgressReceiver progressReceiver) throws OperationCancelled {
            progressReceiver = new TaskbarProgressReceiver(App.getInstance(), progressReceiver);
            progressReceiver.setMessage("Exporting world " + name);
            WorldExporter exporter = PlatformManager.getInstance().getExporter(world);
            try {
                backupDir = exporter.selectBackupDir(new File(baseDir, FileUtils.sanitiseName(name)));
                return exporter.export(baseDir, name, backupDir, progressReceiver);
            } catch (IOException e) {
                throw new RuntimeException("I/O error while exporting world", e);
            }
        }
    };
}
Also used : ProgressTask(org.pepsoft.util.swing.ProgressTask) TaskbarProgressReceiver(org.pepsoft.util.TaskbarProgressReceiver) ProgressReceiver(org.pepsoft.util.ProgressReceiver) WorldExporter(org.pepsoft.worldpainter.exporting.WorldExporter) IOException(java.io.IOException) TaskbarProgressReceiver(org.pepsoft.util.TaskbarProgressReceiver) File(java.io.File)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 ProgressReceiver (org.pepsoft.util.ProgressReceiver)1 TaskbarProgressReceiver (org.pepsoft.util.TaskbarProgressReceiver)1 ProgressTask (org.pepsoft.util.swing.ProgressTask)1 WorldExporter (org.pepsoft.worldpainter.exporting.WorldExporter)1