]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.export.core/src/org/simantics/export/core/manager/ExportManager.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.export.core / src / org / simantics / export / core / manager / ExportManager.java
index 5ca1a33f409ec7c1097814b245c449bd7b963335..ecfbbd0d28907d87ce48c330808fc7faca258ccf 100644 (file)
@@ -1,97 +1,97 @@
-package org.simantics.export.core.manager;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.SubMonitor;\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
- * This class exports content.\r
- *\r
- * @author toni.kalajainen@semantum.fi\r
- * @author tuukka.lehtonen@semantum.fi\r
- */\r
-public class ExportManager {\r
-\r
-       public Variant options;\r
-       public ExportContext ctx;\r
-\r
-       public ExportManager(Variant options, ExportContext ctx) {\r
-               this.options = options;\r
-               this.ctx = ctx;\r
-       }\r
-\r
-       /**\r
-        * Execute export plan\r
-        * \r
-        * @param ctx\r
-        *            export context\r
-        * @param monitor\r
-        *            the progress monitor to use for reporting progress to the\r
-        *            user. It is the caller's responsibility to call done() on the\r
-        *            given monitor. Accepts <code>null</code>, indicating that no\r
-        *            progress should be reported and that the operation cannot be\r
-        *            cancelled.</pre>\r
-        * @param plan\r
-        *            export plan\r
-        * @throws ExportException\r
-        */\r
-       public void execute(ExportContext ctx, IProgressMonitor monitor, ExportPlan plan) throws ExportException\r
-       {\r
-               // 10000 units for all actions and 10 units the cleanup of each\r
-               int totalWork = plan.totalWork(ctx) * 10000 + plan.actions.size() * 100;\r
-               monitor.beginTask( plan.label, totalWork );\r
-               SubMonitor mon = SubMonitor.convert(monitor, plan.label, totalWork);\r
-\r
-               try {\r
-\r
-                       try {\r
-                               // 1. Export\r
-                               for ( ExportAction action : plan.actions ) {\r
-                                       if ( monitor.isCanceled() ) return;\r
-                                       int work = action.work(ctx) * 10000;\r
-                                       mon.setTaskName( action.label(ctx) );\r
-                                       action.execute(ctx, mon.newChild(work), options);\r
-                               }\r
-                       } finally {\r
-                               // 2. Cleanup\r
-                               for ( ExportAction action : plan.actions ) {\r
-                                       mon.setTaskName( "Cleanup: " + action.label(ctx) );\r
-                                       try {\r
-                                               action.cleanup(ctx, mon.newChild(100), options);\r
-                                       } catch (ExportException ee) {\r
-                                               ee.printStackTrace();\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-               } catch (ExportException ee) {\r
-                       monitor.setTaskName( ee.getClass().getName()+": "+ee.getClass().getName() );\r
-                       throw ee;\r
-               }\r
-       }\r
-\r
-       /**\r
-        * Validate the plan is executable.\r
-        * \r
-        * @param ctx\r
-        * @param optionsBinding\r
-        * @param options\r
-        * @return null or a label describing the expected problem\r
-        */\r
-       public List<String> validate(ExportContext ctx, ExportPlan plan)\r
-       {\r
-               List<String> result = new ArrayList<String>(0);\r
-               for ( ExportAction action : plan.actions ) {\r
-                       List<String> problems = action.validate(ctx, options);\r
-                       result.addAll( problems );\r
-               }\r
-               return result;\r
-       }\r
-\r
-\r
-}\r
+package org.simantics.export.core.manager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.simantics.databoard.binding.mutable.Variant;
+import org.simantics.export.core.ExportContext;
+import org.simantics.export.core.error.ExportException;
+
+/**
+ * This class exports content.
+ *
+ * @author toni.kalajainen@semantum.fi
+ * @author tuukka.lehtonen@semantum.fi
+ */
+public class ExportManager {
+
+       public Variant options;
+       public ExportContext ctx;
+
+       public ExportManager(Variant options, ExportContext ctx) {
+               this.options = options;
+               this.ctx = ctx;
+       }
+
+       /**
+        * Execute export plan
+        * 
+        * @param ctx
+        *            export context
+        * @param monitor
+        *            the progress monitor to use for reporting progress to the
+        *            user. It is the caller's responsibility to call done() on the
+        *            given monitor. Accepts <code>null</code>, indicating that no
+        *            progress should be reported and that the operation cannot be
+        *            cancelled.</pre>
+        * @param plan
+        *            export plan
+        * @throws ExportException
+        */
+       public void execute(ExportContext ctx, IProgressMonitor monitor, ExportPlan plan) throws ExportException
+       {
+               // 10000 units for all actions and 10 units the cleanup of each
+               int totalWork = plan.totalWork(ctx) * 10000 + plan.actions.size() * 100;
+               monitor.beginTask( plan.label, totalWork );
+               SubMonitor mon = SubMonitor.convert(monitor, plan.label, totalWork);
+
+               try {
+
+                       try {
+                               // 1. Export
+                               for ( ExportAction action : plan.actions ) {
+                                       if ( monitor.isCanceled() ) return;
+                                       int work = action.work(ctx) * 10000;
+                                       mon.setTaskName( action.label(ctx) );
+                                       action.execute(ctx, mon.newChild(work), options);
+                               }
+                       } finally {
+                               // 2. Cleanup
+                               for ( ExportAction action : plan.actions ) {
+                                       mon.setTaskName( "Cleanup: " + action.label(ctx) );
+                                       try {
+                                               action.cleanup(ctx, mon.newChild(100), options);
+                                       } catch (ExportException ee) {
+                                               ee.printStackTrace();
+                                       }
+                               }
+                       }
+
+               } catch (ExportException ee) {
+                       monitor.setTaskName( ee.getClass().getName()+": "+ee.getClass().getName() );
+                       throw ee;
+               }
+       }
+
+       /**
+        * Validate the plan is executable.
+        * 
+        * @param ctx
+        * @param optionsBinding
+        * @param options
+        * @return null or a label describing the expected problem
+        */
+       public List<String> validate(ExportContext ctx, ExportPlan plan)
+       {
+               List<String> result = new ArrayList<String>(0);
+               for ( ExportAction action : plan.actions ) {
+                       List<String> problems = action.validate(ctx, options);
+                       result.addAll( problems );
+               }
+               return result;
+       }
+
+
+}