]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.export.core/src/org/simantics/export/core/manager/ExportAction.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.export.core / src / org / simantics / export / core / manager / ExportAction.java
diff --git a/bundles/org.simantics.export.core/src/org/simantics/export/core/manager/ExportAction.java b/bundles/org.simantics.export.core/src/org/simantics/export/core/manager/ExportAction.java
new file mode 100644 (file)
index 0000000..94b62fb
--- /dev/null
@@ -0,0 +1,63 @@
+package org.simantics.export.core.manager;\r
+\r
+import java.util.List;\r
+\r
+import org.eclipse.core.runtime.IProgressMonitor;\r
+import org.simantics.databoard.binding.mutable.Variant;\r
+import org.simantics.export.core.ExportContext;\r
+import org.simantics.export.core.error.ExportException;\r
+\r
+/**\r
+ * A single article of export action in an export plan.\r
+ *\r
+ * @author toni.kalajainen@semantum.fi\r
+ */\r
+public abstract class ExportAction {\r
+       \r
+       /**\r
+        * Execute export action.\r
+        * \r
+        * @param ctx\r
+        * @param progress\r
+        * @param options\r
+        * @throws ExportException\r
+        */\r
+       public abstract void execute(ExportContext ctx, IProgressMonitor progress, Variant options)\r
+                       throws ExportException;\r
+       \r
+       /**\r
+        * Get the label for this action to be used in user interface.\r
+        * \r
+        * @param ctx\r
+        * @return the label for this action.\r
+        */\r
+       public abstract String label(ExportContext ctx);\r
+       \r
+       /**\r
+        * Get the amount of work in this action (used in progress bar).\r
+        * \r
+        * @param ctx\r
+        * @return the amount of work\r
+        */\r
+       public abstract int work(ExportContext ctx);\r
+       \r
+       /**\r
+        * Validate action is executable\r
+        * \r
+        * @param ctx\r
+        * @param options\r
+        * @return null or a label describing the expected problem\r
+        */\r
+       public abstract List<String> validate(ExportContext ctx, Variant options);\r
+       \r
+       /**\r
+        * Cancel and cleanup the output of this action. Deletes temporary files. \r
+        * \r
+        * @param ctx\r
+        * @param progress\r
+        * @param options\r
+        * @throws ExportException\r
+        */\r
+       public abstract void cleanup(ExportContext ctx, IProgressMonitor progress, Variant options) throws ExportException;\r
+       \r
+}\r