]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.export.core/src/org/simantics/export/core/manager/ExportAction.java
ImportPdfReader now implements Closeable
[simantics/platform.git] / bundles / org.simantics.export.core / src / org / simantics / export / core / manager / ExportAction.java
1 package org.simantics.export.core.manager;
2
3 import java.util.List;
4
5 import org.eclipse.core.runtime.IProgressMonitor;
6 import org.simantics.databoard.binding.mutable.Variant;
7 import org.simantics.export.core.ExportContext;
8 import org.simantics.export.core.error.ExportException;
9
10 /**
11  * A single article of export action in an export plan.
12  *
13  * @author toni.kalajainen@semantum.fi
14  */
15 public abstract class ExportAction {
16         
17         /**
18          * Execute export action.
19          * 
20          * @param ctx
21          * @param progress
22          * @param options
23          * @throws ExportException
24          */
25         public abstract void execute(ExportContext ctx, IProgressMonitor progress, Variant options)
26                         throws ExportException;
27         
28         /**
29          * Get the label for this action to be used in user interface.
30          * 
31          * @param ctx
32          * @return the label for this action.
33          */
34         public abstract String label(ExportContext ctx);
35         
36         /**
37          * Get the amount of work in this action (used in progress bar).
38          * 
39          * @param ctx
40          * @return the amount of work
41          */
42         public abstract int work(ExportContext ctx);
43         
44         /**
45          * Validate action is executable
46          * 
47          * @param ctx
48          * @param options
49          * @return null or a label describing the expected problem
50          */
51         public abstract List<String> validate(ExportContext ctx, Variant options);
52         
53         /**
54          * Cancel and cleanup the output of this action. Deletes temporary files. 
55          * 
56          * @param ctx
57          * @param progress
58          * @param options
59          * @throws ExportException
60          */
61         public abstract void cleanup(ExportContext ctx, IProgressMonitor progress, Variant options) throws ExportException;
62         
63 }