X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.charts%2Fsrc%2Forg%2Fsimantics%2Fcharts%2Feditor%2FTrackExperimentTimeAction.java;fp=bundles%2Forg.simantics.charts%2Fsrc%2Forg%2Fsimantics%2Fcharts%2Feditor%2FTrackExperimentTimeAction.java;h=3faade476fa593330d4d9779079a0709dc010297;hp=482ac3acf41180fed530cc9dc9621d3e79b50137;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/editor/TrackExperimentTimeAction.java b/bundles/org.simantics.charts/src/org/simantics/charts/editor/TrackExperimentTimeAction.java index 482ac3acf..3faade476 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/editor/TrackExperimentTimeAction.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/editor/TrackExperimentTimeAction.java @@ -1,46 +1,46 @@ -package org.simantics.charts.editor; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.action.Action; -import org.simantics.Simantics; -import org.simantics.charts.Activator; -import org.simantics.charts.ontology.ChartResource; -import org.simantics.charts.query.SetProperty; -import org.simantics.databoard.Bindings; -import org.simantics.db.Resource; -import org.simantics.db.Session; -import org.simantics.db.exception.DatabaseException; - -/** - * @author Tuukka Lehtonen - */ -public class TrackExperimentTimeAction extends Action { - - private Resource chart; - private Boolean currentValue; - - public TrackExperimentTimeAction(String name, Resource chart, boolean currentValue) { - super(name, Action.AS_CHECK_BOX); - this.chart = chart; - this.currentValue = currentValue; - setChecked(currentValue); - } - - @Override - public void run() { - setTracking(chart, !currentValue); - } - - public static void setTracking(Resource chart, boolean newValue) { - try { - Session session = Simantics.getSession(); - ChartResource CHART = ChartResource.getInstance(session); - session.markUndoPoint(); - session.syncRequest(new SetProperty(chart, CHART.Chart_trackExperimentTime, newValue, Bindings.BOOLEAN)); - } catch (DatabaseException e) { - Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to set track experiment time.", e)); - } - } - +package org.simantics.charts.editor; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.action.Action; +import org.simantics.Simantics; +import org.simantics.charts.Activator; +import org.simantics.charts.ontology.ChartResource; +import org.simantics.charts.query.SetProperty; +import org.simantics.databoard.Bindings; +import org.simantics.db.Resource; +import org.simantics.db.Session; +import org.simantics.db.exception.DatabaseException; + +/** + * @author Tuukka Lehtonen + */ +public class TrackExperimentTimeAction extends Action { + + private Resource chart; + private Boolean currentValue; + + public TrackExperimentTimeAction(String name, Resource chart, boolean currentValue) { + super(name, Action.AS_CHECK_BOX); + this.chart = chart; + this.currentValue = currentValue; + setChecked(currentValue); + } + + @Override + public void run() { + setTracking(chart, !currentValue); + } + + public static void setTracking(Resource chart, boolean newValue) { + try { + Session session = Simantics.getSession(); + ChartResource CHART = ChartResource.getInstance(session); + session.markUndoPoint(); + session.syncRequest(new SetProperty(chart, CHART.Chart_trackExperimentTime, newValue, Bindings.BOOLEAN)); + } catch (DatabaseException e) { + Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to set track experiment time.", e)); + } + } + } \ No newline at end of file