]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.simulation/src/org/simantics/simulation/project/CountingExperimentActivationListener.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.simulation / src / org / simantics / simulation / project / CountingExperimentActivationListener.java
index aecce15b78968992bcb71f6f5ad18d1bb7996470..b04e2fd6a41d33c1ad37ff8e8de56cb4004d9f31 100644 (file)
@@ -1,68 +1,68 @@
-/*******************************************************************************\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.project;\r
-\r
-import java.util.concurrent.atomic.AtomicBoolean;\r
-import java.util.concurrent.atomic.AtomicInteger;\r
-\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.IStatus;\r
-import org.simantics.simulation.Activator;\r
-import org.simantics.simulation.experiment.IExperiment;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class CountingExperimentActivationListener implements IExperimentActivationListener {\r
-\r
-    IExperimentActivationListener proxy;\r
-    AtomicInteger                 activationCounter;\r
-    IProgressMonitor              monitor;\r
-    AtomicBoolean                 excepted = new AtomicBoolean(false);\r
-\r
-    public CountingExperimentActivationListener(IExperimentActivationListener proxy, int expectedActivations) {\r
-        this(proxy, expectedActivations, null);\r
-    }\r
-\r
-    public CountingExperimentActivationListener(IExperimentActivationListener proxy, int expectedActivations, IProgressMonitor monitor) {\r
-        this.proxy = proxy;\r
-        this.activationCounter = new AtomicInteger(expectedActivations);\r
-        this.monitor = monitor;\r
-    }\r
-\r
-    @Override\r
-    public void onMessage(IStatus message) {\r
-        proxy.onMessage(message);\r
-    }\r
-\r
-    @Override\r
-    public void onExperimentActivated(IExperiment experiment) {\r
-        if (activationCounter.decrementAndGet() == 0) {\r
-            if (!excepted.get())\r
-                proxy.onExperimentActivated(experiment);\r
-        }\r
-    }\r
-\r
-    @Override\r
-    public void onFailure(Throwable e) {\r
-        if (excepted.compareAndSet(false, true))\r
-            proxy.onFailure(e);\r
-        else\r
-            Activator.logError(e.getMessage(), e);\r
-    }\r
-\r
-    @Override\r
-    public IProgressMonitor getProgressMonitor() {\r
-        return monitor != null ? monitor : proxy.getProgressMonitor();\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.project;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.simantics.simulation.Activator;
+import org.simantics.simulation.experiment.IExperiment;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class CountingExperimentActivationListener implements IExperimentActivationListener {
+
+    IExperimentActivationListener proxy;
+    AtomicInteger                 activationCounter;
+    IProgressMonitor              monitor;
+    AtomicBoolean                 excepted = new AtomicBoolean(false);
+
+    public CountingExperimentActivationListener(IExperimentActivationListener proxy, int expectedActivations) {
+        this(proxy, expectedActivations, null);
+    }
+
+    public CountingExperimentActivationListener(IExperimentActivationListener proxy, int expectedActivations, IProgressMonitor monitor) {
+        this.proxy = proxy;
+        this.activationCounter = new AtomicInteger(expectedActivations);
+        this.monitor = monitor;
+    }
+
+    @Override
+    public void onMessage(IStatus message) {
+        proxy.onMessage(message);
+    }
+
+    @Override
+    public void onExperimentActivated(IExperiment experiment) {
+        if (activationCounter.decrementAndGet() == 0) {
+            if (!excepted.get())
+                proxy.onExperimentActivated(experiment);
+        }
+    }
+
+    @Override
+    public void onFailure(Throwable e) {
+        if (excepted.compareAndSet(false, true))
+            proxy.onFailure(e);
+        else
+            Activator.logError(e.getMessage(), e);
+    }
+
+    @Override
+    public IProgressMonitor getProgressMonitor() {
+        return monitor != null ? monitor : proxy.getProgressMonitor();
+    }
+
+}