-package org.simantics.charts.editor.e4;\r
-\r
-import java.util.List;\r
-\r
-import javax.inject.Named;\r
-\r
-import org.eclipse.e4.core.di.annotations.CanExecute;\r
-import org.eclipse.e4.core.di.annotations.Execute;\r
-import org.eclipse.e4.ui.di.AboutToHide;\r
-import org.eclipse.e4.ui.di.AboutToShow;\r
-import org.eclipse.e4.ui.model.application.ui.basic.MPart;\r
-import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;\r
-import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;\r
-import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;\r
-import org.eclipse.e4.ui.services.IServiceConstants;\r
-import org.simantics.charts.editor.TrackExperimentTimeAction;\r
-import org.simantics.trend.configuration.TrendSpec;\r
-import org.simantics.trend.impl.ItemNode;\r
-import org.simantics.trend.impl.TrendNode;\r
-import org.simantics.trend.impl.TrendParticipant;\r
-\r
-public class MoveHairlineHandler {\r
-\r
- @AboutToShow\r
- public void aboutToShow(List<MMenuElement> items) {\r
- MDirectMenuItem menuItem = MMenuFactory.INSTANCE.createDirectMenuItem();\r
- menuItem.setContributionURI("bundleclass://org.simantics.charts/org.simantics.charts.editor.e4.MoveHairlineHandler");\r
- menuItem.setLabel("Move Hairline Here");\r
- items.add(menuItem);\r
- }\r
- \r
- @AboutToHide\r
- public void aboutToHide() {\r
- \r
- }\r
- \r
- @CanExecute\r
- public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart) {\r
- if (activePart != null && activePart.getObject() instanceof TimeSeriesEditor) {\r
- TimeSeriesEditor editor = (TimeSeriesEditor) activePart.getObject();\r
- \r
- TrendNode trendNode = editor.trendNode;\r
- TrendParticipant tp = editor.tp;\r
- if (trendNode == null || tp == null)\r
- return false;\r
- \r
- TrendSpec trendSpec = trendNode.getTrendSpec();\r
- boolean hairlineMovementAllowed =\r
- !(trendSpec.experimentIsRunning &&\r
- trendSpec.viewProfile.trackExperimentTime);\r
- \r
- return hairlineMovementAllowed;\r
- }\r
- return false;\r
- }\r
- \r
- @Execute\r
- public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart) {\r
- if (activePart.getObject() instanceof TimeSeriesEditor) {\r
- TimeSeriesEditor editor = (TimeSeriesEditor) activePart.getObject();\r
- \r
- TrendNode trendNode = editor.trendNode;\r
- TrendParticipant tp = editor.tp;\r
- if (trendNode == null || tp == null)\r
- return;\r
-\r
- TrendSpec trendSpec = trendNode.getTrendSpec();\r
- ItemNode hoverItem = tp.hoveringItem;\r
- \r
- // #TODO Finish this when we are fully in E4 workbench\r
- \r
-// trend.valueTipTime = time;\r
-// trend.repaint();\r
-// if (setTrackExperimentTime != null) {\r
-// TrackExperimentTimeAction.setTracking(chart, setTrackExperimentTime);\r
-// }\r
- \r
- }\r
- }\r
-\r
-}\r
+package org.simantics.charts.editor.e4;
+
+import java.util.List;
+
+import javax.inject.Named;
+
+import org.eclipse.e4.core.di.annotations.CanExecute;
+import org.eclipse.e4.core.di.annotations.Execute;
+import org.eclipse.e4.ui.di.AboutToHide;
+import org.eclipse.e4.ui.di.AboutToShow;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
+import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
+import org.eclipse.e4.ui.services.IServiceConstants;
+import org.simantics.charts.editor.TrackExperimentTimeAction;
+import org.simantics.trend.configuration.TrendSpec;
+import org.simantics.trend.impl.ItemNode;
+import org.simantics.trend.impl.TrendNode;
+import org.simantics.trend.impl.TrendParticipant;
+
+public class MoveHairlineHandler {
+
+ @AboutToShow
+ public void aboutToShow(List<MMenuElement> items) {
+ MDirectMenuItem menuItem = MMenuFactory.INSTANCE.createDirectMenuItem();
+ menuItem.setContributionURI("bundleclass://org.simantics.charts/org.simantics.charts.editor.e4.MoveHairlineHandler");
+ menuItem.setLabel("Move Hairline Here");
+ items.add(menuItem);
+ }
+
+ @AboutToHide
+ public void aboutToHide() {
+
+ }
+
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart) {
+ if (activePart != null && activePart.getObject() instanceof TimeSeriesEditor) {
+ TimeSeriesEditor editor = (TimeSeriesEditor) activePart.getObject();
+
+ TrendNode trendNode = editor.trendNode;
+ TrendParticipant tp = editor.tp;
+ if (trendNode == null || tp == null)
+ return false;
+
+ TrendSpec trendSpec = trendNode.getTrendSpec();
+ boolean hairlineMovementAllowed =
+ !(trendSpec.experimentIsRunning &&
+ trendSpec.viewProfile.trackExperimentTime);
+
+ return hairlineMovementAllowed;
+ }
+ return false;
+ }
+
+ @Execute
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart activePart) {
+ if (activePart.getObject() instanceof TimeSeriesEditor) {
+ TimeSeriesEditor editor = (TimeSeriesEditor) activePart.getObject();
+
+ TrendNode trendNode = editor.trendNode;
+ TrendParticipant tp = editor.tp;
+ if (trendNode == null || tp == null)
+ return;
+
+ TrendSpec trendSpec = trendNode.getTrendSpec();
+ ItemNode hoverItem = tp.hoveringItem;
+
+ // #TODO Finish this when we are fully in E4 workbench
+
+// trend.valueTipTime = time;
+// trend.repaint();
+// if (setTrackExperimentTime != null) {
+// TrackExperimentTimeAction.setTracking(chart, setTrackExperimentTime);
+// }
+
+ }
+ }
+
+}