]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/GraphUI.java
Merge commit 'e87f096'
[simantics/platform.git] / bundles / org.simantics.spreadsheet.graph / src / org / simantics / spreadsheet / graph / GraphUI.java
index 9a3e8732679d284b4a30abfdbcfc274da9a708e7..b2fc404f23f200b1ff3477ce24e45c8bd22652e0 100644 (file)
@@ -61,7 +61,6 @@ import org.simantics.spreadsheet.CellEditor;
 import org.simantics.spreadsheet.ClientModel;\r
 import org.simantics.spreadsheet.ClientModel.OperationMode;\r
 import org.simantics.spreadsheet.SheetCommands;\r
-import org.simantics.spreadsheet.common.logging.Logger;\r
 import org.simantics.spreadsheet.event.model.RemoveCellHandler;\r
 import org.simantics.spreadsheet.resource.SpreadsheetResource;\r
 import org.simantics.ui.selection.WorkbenchSelectionUtils;\r
@@ -69,6 +68,8 @@ import org.simantics.utils.datastructures.Pair;
 import org.simantics.utils.strings.AlphanumComparator;\r
 import org.simantics.utils.threads.logger.ITask;\r
 import org.simantics.utils.threads.logger.ThreadLogger;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
 \r
 import gnu.trove.map.hash.THashMap;\r
 import gnu.trove.map.hash.TObjectIntHashMap;\r
@@ -102,6 +103,8 @@ class FilteredVariableProperties extends UnaryRead<Variable, Collection<Pair<Str
 \r
 public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport, SyncListenerSupport {\r
 \r
+       private static final Logger LOGGER = LoggerFactory.getLogger(GraphUI.class);\r
+\r
        final public static boolean DEBUG = false;\r
        \r
     final private RequestProcessor processor;\r
@@ -214,10 +217,10 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
        \r
        support.addListener(listener);\r
 \r
-        this.cellEditor = processor.sync(new VariableRead<CellEditor>(variable) {\r
+        this.cellEditor = processor.sync(new VariableRead<CellEditor<Write>>(variable) {\r
 \r
                        @Override\r
-                       public CellEditor perform(ReadGraph graph) throws DatabaseException {\r
+                       public CellEditor<Write> perform(ReadGraph graph) throws DatabaseException {\r
                                SpreadsheetResource SHEET = SpreadsheetResource.getInstance(graph);\r
                                return variable.getPropertyValue(graph, SHEET.cellEditor);\r
                        }\r
@@ -338,6 +341,8 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
     \r
     private static class PropertyListener extends SingleSetSyncListenerDelegate<Pair<String,Variable>> {\r
 \r
+        private static final Logger LOGGER = LoggerFactory.getLogger(PropertyListener.class);\r
+\r
         private ClientModel client;\r
         private String childName;\r
         private boolean listenerDisposed;\r
@@ -370,7 +375,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                 @Override\r
                 public void exception(ReadGraph graph, Throwable throwable) throws DatabaseException {\r
                     \r
-                    Logger.defaultLogError(throwable);\r
+                    LOGGER.error("PropertyListener.exception", throwable);\r
                     \r
                     String propertyName = property.first;\r
                     if("content".equals(propertyName)) {\r
@@ -492,7 +497,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                return (T)new CellEditor<Write>() {\r
 \r
                                @Override\r
-                               public <T> void edit(Transaction<Write> transaction, String location, String property, T value, Binding binding, Consumer<?> callback) {\r
+                               public <E> void edit(Transaction<Write> transaction, String location, String property, E value, Binding binding, Consumer<?> callback) {\r
                                        \r
                                    if (ClientModel.ITERATION_ENABLED.equals(location)) {\r
                                        Simantics.getSession().asyncRequest(new ReadRequest() {\r
@@ -539,7 +544,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                                     load(newContext, client);\r
                                     return;\r
                                 } catch (DatabaseException e) {\r
-                                    Logger.defaultLogError(e);\r
+                                    LOGGER.error("edit failed for model key '" + ClientModel.CONTEXT_CURRENT + "'", e);\r
                                 }\r
                             }\r
                                        }\r
@@ -564,7 +569,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                                                                        load(newInput, client);\r
                                                                        return;\r
                                                                } catch (DatabaseException e) {\r
-                                                                       Logger.defaultLogError(e);\r
+                                                                       LOGGER.error("edit failed for model key '" + ClientModel.SHEETS_CURRENT + "'", e);\r
                                                                }\r
                                                        }\r
                                                }\r
@@ -610,7 +615,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
 //                                    fullSynchronize();\r
                                     return;\r
                                 } catch (DatabaseException e) {\r
-                                    Logger.defaultLogError(e);\r
+                                    LOGGER.error("edit failed for model key '" + ClientModel.STATES_CURRENT + "'", e);\r
                                 }\r
                             }\r
                         }\r
@@ -664,7 +669,7 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
                                                                }\r
                                                                \r
                                                        } catch (DatabaseException e) {\r
-                                                               Logger.defaultLogError(e);\r
+                                                               LOGGER.error("edit failed for model key '" + ClientModel.SOURCES_CURRENT + "'", e);\r
                                                        }\r
                                                }\r
                                                return;\r
@@ -796,12 +801,12 @@ public class GraphUI implements Adaptable, ListenerSupport, AsyncListenerSupport
 \r
     @Override\r
     public void exception(AsyncReadGraph graph, Throwable t) {\r
-       Logger.defaultLogError("Failed to read properties.", t);\r
+        LOGGER.error("Failed to read properties.", t);\r
     }\r
 \r
     @Override\r
     public void exception(ReadGraph graph, Throwable t) {\r
-       Logger.defaultLogError("Failed to read properties.", t);\r
+        LOGGER.error("Failed to read properties.", t);\r
     }\r
 \r
     public void dispose() {\r