X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.spreadsheet.graph%2Fsrc%2Forg%2Fsimantics%2Fspreadsheet%2Fgraph%2FGraphUI.java;h=03df2dd0a8eb8f99af62ee7d6cfb31b012dfd660;hp=607661163f5f138701da9e08acf46ea61d48cb46;hb=0d9b90834ce56b292c00b1a39850ed842c3e4d42;hpb=e5db6157fd8722c946613d4e46d7aaf6bfa92609 diff --git a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphUI.java b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphUI.java index 607661163..03df2dd0a 100644 --- a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphUI.java +++ b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphUI.java @@ -1,5 +1,5 @@ /******************************************************************************* - * 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 @@ -135,7 +135,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport listener = propertyListener(client, childName); listenerCache.put(child.first, listener); } - graph.asyncRequest(new FilteredVariableProperties(child.second), listener); + graph.syncRequest(new FilteredVariableProperties(child.second), listener); } } @@ -347,7 +347,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport 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; @@ -359,7 +359,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport if(DEBUG) System.out.println("GraphUI adds property " + property.second.getURI(graph)); - graph.asyncRequest(new CellValue(property.second), new SyncListener() { + graph.syncRequest(new CellValue(property.second), new SyncListener() { @Override public void execute(ReadGraph graph, final Object value) throws DatabaseException { @@ -456,37 +456,41 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport @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); + } } @@ -791,7 +795,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport @Override public void exception(Throwable t) { - t.printStackTrace(); + LOGGER.error("Failed to read properties.", t); } @Override