/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 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
import org.simantics.db.common.request.WriteResultRequest;
import org.simantics.db.common.session.SessionEventListenerAdapter;
import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.layer0.StandardRealm;
import org.simantics.db.layer0.request.PossibleURIVariable;
import org.simantics.db.layer0.request.VariableName;
import org.simantics.db.layer0.request.VariableRead;
import org.simantics.db.request.Write;
import org.simantics.db.service.SessionEventSupport;
import org.simantics.layer0.Layer0;
+import org.simantics.simulator.toolkit.StandardRealm;
import org.simantics.spreadsheet.Adaptable;
import org.simantics.spreadsheet.CellEditor;
import org.simantics.spreadsheet.ClientModel;
import org.simantics.spreadsheet.SheetCommands;
import org.simantics.spreadsheet.event.model.RemoveCellHandler;
import org.simantics.spreadsheet.resource.SpreadsheetResource;
+import org.simantics.spreadsheet.solver.SheetNode;
+import org.simantics.spreadsheet.solver.SpreadsheetBook;
import org.simantics.ui.selection.WorkbenchSelectionUtils;
import org.simantics.utils.datastructures.Pair;
import org.simantics.utils.strings.AlphanumComparator;
listener = propertyListener(client, childName);
listenerCache.put(child.first, listener);
}
- graph.asyncRequest(new FilteredVariableProperties(child.second), listener);
+ graph.syncRequest(new FilteredVariableProperties(child.second), listener);
}
}
private String childName;
private boolean listenerDisposed;
- public PropertyListener(AsyncListenerSupport support, ClientModel client, String childName) {
+ public PropertyListener(SyncListenerSupport support, ClientModel client, String childName) {
super(support);
this.client = client;
this.childName = childName;
if(DEBUG)
System.out.println("GraphUI adds property " + property.second.getURI(graph));
- graph.asyncRequest(new CellValue(property.second), new SyncListener<Object>() {
+ graph.syncRequest(new CellValue(property.second), new SyncListener<Object>() {
@Override
public void execute(ReadGraph graph, final Object value) throws DatabaseException {
@Override
public void handle(final String location) {
- processor.asyncRequest(new ReadRequest() {
-
- @Override
- public void run(ReadGraph graph) throws DatabaseException {
-
- Variable cellVariable = run.getPossibleChild(graph, location);
- if(cellVariable != null) {
- final Resource config = cellVariable.getPossiblePropertyValue(graph, "Represents");
- if(config != null) {
-
- graph.asyncRequest(new WriteRequest() {
+ try {
+ processor.syncRequest(new ReadRequest() {
- @Override
- public void perform(WriteGraph graph) throws DatabaseException {
-
- Layer0 l0 = Layer0.getInstance(graph);
+ @Override
+ public void run(ReadGraph graph) throws DatabaseException {
+
+ Variable cellVariable = run.getPossibleChild(graph, location);
+ if(cellVariable != null) {
+ final Resource config = cellVariable.getPossiblePropertyValue(graph, "Represents");
+ if(config != null) {
+
+ graph.asyncRequest(new WriteRequest() {
+
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+
+ Layer0 l0 = Layer0.getInstance(graph);
// SpreadsheetResource sr = SpreadsheetResource.getInstance(graph);
- graph.deny(config, l0.PartOf);
+ graph.deny(config, l0.PartOf);
// graph.deny(config, sr.RowOf);
// graph.deny(config, sr.ColumnOf);
-
- }
-
- });
-
+
+ }
+
+ });
+
+ }
}
+
}
-
- }
-
- });
+
+ });
+ } catch (DatabaseException e) {
+ LOGGER.error("Unexpected exception while removing cell", e);
+ }
}
String contextURI = context.getURI(graph);
String sessionName = context.getParent(graph).getURI(graph);
- SpreadsheetSessionManager.getInstance().removeRealm(sessionName);
+ SpreadsheetSessionManager.getInstance().removeRealm(graph, sessionName);
SpreadsheetSessionManager.getInstance().getOrCreateRealm(graph, sessionName);
}
@Override
public void exception(Throwable t) {
- t.printStackTrace();
+ LOGGER.error("Failed to read properties.", t);
}
@Override