]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/Dispose.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.simulation.ui / src / org / simantics / simulation / ui / handlers / Dispose.java
index 67120386c13d2c3b076e3be317203c4fee287750..cd376cf540eb190380ea59755a4008c51a84bce0 100644 (file)
@@ -1,61 +1,61 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.simulation.ui.handlers;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-\r
-import org.eclipse.core.commands.AbstractHandler;\r
-import org.eclipse.core.commands.ExecutionEvent;\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.SubMonitor;\r
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;\r
-import org.eclipse.jface.operation.IRunnableWithProgress;\r
-import org.eclipse.ui.handlers.HandlerUtil;\r
-import org.simantics.project.IProject;\r
-import org.simantics.simulation.experiment.IExperiment;\r
-import org.simantics.simulation.project.IExperimentManager;\r
-import org.simantics.ui.SimanticsUI;\r
-import org.simantics.utils.ui.ExceptionUtils;\r
-\r
-public class Dispose extends AbstractHandler {\r
-\r
-    @Override\r
-    public Object execute(ExecutionEvent event) throws ExecutionException {\r
-        IProject project = SimanticsUI.getProject();\r
-        IExperimentManager manager = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
-        final IExperiment experiment = manager.getActiveExperiment();\r
-        if (experiment == null)\r
-            return null;\r
-\r
-        try {\r
-            new ProgressMonitorDialog(HandlerUtil.getActiveShell(event)).run(true, false, new IRunnableWithProgress() {\r
-                @Override\r
-                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {\r
-                    SubMonitor mon = SubMonitor.convert(monitor, "Shutdown experiment...", 10000);\r
-                    try {\r
-                        experiment.shutdown(mon.newChild(10000));\r
-                    } finally {\r
-                        monitor.done();\r
-                    }\r
-                }\r
-            });\r
-        } catch (InvocationTargetException e) {\r
-            ExceptionUtils.logAndShowError(e.getCause());\r
-        } catch (InterruptedException e) {\r
-            ExceptionUtils.logAndShowError(e.getCause());\r
-        }\r
-\r
-        return null;\r
-    }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.simulation.ui.handlers;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.simantics.project.IProject;
+import org.simantics.simulation.experiment.IExperiment;
+import org.simantics.simulation.project.IExperimentManager;
+import org.simantics.ui.SimanticsUI;
+import org.simantics.utils.ui.ExceptionUtils;
+
+public class Dispose extends AbstractHandler {
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        IProject project = SimanticsUI.getProject();
+        IExperimentManager manager = project.getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);
+        final IExperiment experiment = manager.getActiveExperiment();
+        if (experiment == null)
+            return null;
+
+        try {
+            new ProgressMonitorDialog(HandlerUtil.getActiveShell(event)).run(true, false, new IRunnableWithProgress() {
+                @Override
+                public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+                    SubMonitor mon = SubMonitor.convert(monitor, "Shutdown experiment...", 10000);
+                    try {
+                        experiment.shutdown(mon.newChild(10000));
+                    } finally {
+                        monitor.done();
+                    }
+                }
+            });
+        } catch (InvocationTargetException e) {
+            ExceptionUtils.logAndShowError(e.getCause());
+        } catch (InterruptedException e) {
+            ExceptionUtils.logAndShowError(e.getCause());
+        }
+
+        return null;
+    }
+
+}