X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fadapters%2FActiveExperiment.java;fp=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fadapters%2FActiveExperiment.java;h=25082437920901f29d4ef3eff54a540c51686881;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=187d56e49cba433877286cad4001d06c8c03a643;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/ActiveExperiment.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/ActiveExperiment.java index 187d56e49..250824379 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/ActiveExperiment.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/ActiveExperiment.java @@ -1,51 +1,51 @@ -/******************************************************************************* - * Copyright (c) 2012 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.modeling.adapters; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.common.utils.Logger; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.layer0.request.PossibleActiveExperimentPath; -import org.simantics.db.layer0.variable.Variable; -import org.simantics.db.layer0.variable.Variables; -import org.simantics.scl.runtime.function.FunctionImpl2; - -/** - * f: (ReadGraph, Resource model) -> Variable activeExperiment - * - * @author Tuukka Lehtonen - */ -public class ActiveExperiment extends FunctionImpl2 { - - @Override - public Variable apply(ReadGraph p0, Resource p1) { - try { - ReadGraph graph = (ReadGraph) p0; - Resource model = (Resource) p1; - - String activeExperimentPath = graph.syncRequest(new PossibleActiveExperimentPath(model)); - if (activeExperimentPath == null) - return null; - - Variable var = Variables.getPossibleVariable(graph, model); - if (var == null) - return null; - Variable run = var.browsePossible(graph, activeExperimentPath); - return run; - } catch (DatabaseException e) { - Logger.defaultLogError(e); - return null; - } - } - -} +/******************************************************************************* + * Copyright (c) 2012 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.modeling.adapters; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.utils.Logger; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.request.PossibleActiveExperimentPath; +import org.simantics.db.layer0.variable.Variable; +import org.simantics.db.layer0.variable.Variables; +import org.simantics.scl.runtime.function.FunctionImpl2; + +/** + * f: (ReadGraph, Resource model) -> Variable activeExperiment + * + * @author Tuukka Lehtonen + */ +public class ActiveExperiment extends FunctionImpl2 { + + @Override + public Variable apply(ReadGraph p0, Resource p1) { + try { + ReadGraph graph = (ReadGraph) p0; + Resource model = (Resource) p1; + + String activeExperimentPath = graph.syncRequest(new PossibleActiveExperimentPath(model)); + if (activeExperimentPath == null) + return null; + + Variable var = Variables.getPossibleVariable(graph, model); + if (var == null) + return null; + Variable run = var.browsePossible(graph, activeExperimentPath); + return run; + } catch (DatabaseException e) { + Logger.defaultLogError(e); + return null; + } + } + +}