1 /*******************************************************************************
2 * Copyright (c) 2017 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Semantum Oy - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.modeling.ui.scl.scriptEditor;
14 import org.simantics.Simantics;
15 import org.simantics.db.exception.DatabaseException;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
20 * @author Tuukka Lehtonen
23 class SCLScriptSource {
25 private static final Logger LOGGER = LoggerFactory.getLogger(SCLScriptSource.class);
27 private String scriptURI;
28 private String scriptText;
30 public SCLScriptSource(String scriptURI, String scriptText) {
31 this.scriptURI = scriptURI;
32 this.scriptText = scriptText;
35 public void update(String newSourceText) {
37 Simantics.getSession().syncRequest(new WriteSCLScriptDefinition(scriptURI, newSourceText));
38 } catch (DatabaseException e) {
39 LOGGER.error("Failed to write SCL script source from " + scriptURI, e);
43 public boolean isUpdateable() {
47 public String getSourceText() {
51 public String getScriptURI() {