]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.simulation.ui/src/org/simantics/simulation/ui/handlers/e4/Step.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.simulation.ui / src / org / simantics / simulation / ui / handlers / e4 / Step.java
index a4af723b49ec289f706759e8b1a2456c418b6f6a..0dd71f2e54d798f0785c95bce6c5b40423d09ecf 100644 (file)
@@ -1,74 +1,74 @@
-/*******************************************************************************\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.e4;\r
-\r
-import javax.annotation.PostConstruct;\r
-import javax.inject.Inject;\r
-\r
-import org.eclipse.e4.core.di.annotations.CanExecute;\r
-import org.eclipse.e4.core.di.annotations.Execute;\r
-import org.eclipse.e4.core.di.annotations.Optional;\r
-import org.eclipse.e4.ui.di.UIEventTopic;\r
-import org.eclipse.e4.ui.model.application.MApplication;\r
-import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;\r
-import org.eclipse.e4.ui.workbench.modeling.EModelService;\r
-import org.simantics.Simantics;\r
-import org.simantics.simulation.SimulationEvents;\r
-import org.simantics.simulation.experiment.ExperimentUtil;\r
-import org.simantics.simulation.experiment.IExperiment;\r
-import org.simantics.simulation.project.IExperimentManager;\r
-import org.simantics.simulation.ui.preferences.SimulationPreferenceUtil;\r
-import org.simantics.simulation.ui.preferences.SimulationPreferences;\r
-\r
-public class Step {\r
-\r
-    private static final String HANDLED_ITEM_ID = "org.simantics.simulation.ui.handledtoolitem.step";\r
-\r
-    @Inject\r
-    EModelService modelService;\r
-    \r
-    @PostConstruct\r
-    public void updateToolTip(MApplication application) {\r
-        MHandledItem handledItem = (MHandledItem) modelService.find(HANDLED_ITEM_ID, application);\r
-        if (handledItem != null) {\r
-            SimulationPreferences prefs = SimulationPreferenceUtil.getPrefs();\r
-            handledItem.setTooltip("Step " + prefs.stepDuration + "s");\r
-        }\r
-    }\r
-    \r
-    @CanExecute\r
-    public boolean canExecute() {\r
-        IExperimentManager manager = Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);\r
-        if (manager == null)\r
-            return false;\r
-        IExperiment experiment = manager.getActiveExperiment();\r
-        if (experiment == null)\r
-            return false;\r
-        return true;\r
-    }\r
-    \r
-    @Execute\r
-    public void execute() {\r
-        SimulationPreferences prefs = SimulationPreferenceUtil.getPrefs();\r
-        ExperimentUtil.step(prefs.stepDuration);\r
-    }\r
-\r
-    @Inject\r
-    @Optional\r
-    public void updateElement(@UIEventTopic(SimulationEvents.TOPIC_STEP_DURATION) double duration, MApplication application) {\r
-        MHandledItem handledItem = (MHandledItem) modelService.find(HANDLED_ITEM_ID, application);\r
-        if (handledItem != null) {\r
-            handledItem.setTooltip("Step " + duration + "s");\r
-        }\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.e4;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.core.di.annotations.Optional;
+import org.eclipse.e4.ui.di.UIEventTopic;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.simantics.Simantics;
+import org.simantics.simulation.SimulationEvents;
+import org.simantics.simulation.experiment.ExperimentUtil;
+import org.simantics.simulation.experiment.IExperiment;
+import org.simantics.simulation.project.IExperimentManager;
+import org.simantics.simulation.ui.preferences.SimulationPreferenceUtil;
+import org.simantics.simulation.ui.preferences.SimulationPreferences;
+
+public class Step {
+
+    private static final String HANDLED_ITEM_ID = "org.simantics.simulation.ui.handledtoolitem.step";
+
+    @Inject
+    EModelService modelService;
+    
+    @PostConstruct
+    public void updateToolTip(MApplication application) {
+        MHandledItem handledItem = (MHandledItem) modelService.find(HANDLED_ITEM_ID, application);
+        if (handledItem != null) {
+            SimulationPreferences prefs = SimulationPreferenceUtil.getPrefs();
+            handledItem.setTooltip("Step " + prefs.stepDuration + "s");
+        }
+    }
+    
+    @CanExecute
+    public boolean canExecute() {
+        IExperimentManager manager = Simantics.getProject().getHint(IExperimentManager.KEY_EXPERIMENT_MANAGER);
+        if (manager == null)
+            return false;
+        IExperiment experiment = manager.getActiveExperiment();
+        if (experiment == null)
+            return false;
+        return true;
+    }
+    
+    @Execute
+    public void execute() {
+        SimulationPreferences prefs = SimulationPreferenceUtil.getPrefs();
+        ExperimentUtil.step(prefs.stepDuration);
+    }
+
+    @Inject
+    @Optional
+    public void updateElement(@UIEventTopic(SimulationEvents.TOPIC_STEP_DURATION) double duration, MApplication application) {
+        MHandledItem handledItem = (MHandledItem) modelService.find(HANDLED_ITEM_ID, application);
+        if (handledItem != null) {
+            handledItem.setTooltip("Step " + duration + "s");
+        }
+    }
+
+}