]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
AbstractResponseHandler uses wrong identity 21/1421/2
authorAntti Villberg <antti.villberg@semantum.fi>
Tue, 6 Feb 2018 06:15:30 +0000 (08:15 +0200)
committerJani Simomaa <jani.simomaa@semantum.fi>
Tue, 6 Feb 2018 06:30:00 +0000 (08:30 +0200)
refs #7743

Change-Id: I3faabdf8b096758a5fd67c5229a011601083de49

bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java
bundles/org.simantics.document.server/src/org/simantics/document/server/handler/AbstractResponseHandler.java

index 0a7e004f7dcab5e75740d176100c78d59c3dfb47..979be3f26b8e6e63e64f3cba73a81b55f12fa4b2 100644 (file)
@@ -756,12 +756,12 @@ public class Functions {
 
         final List<TCon> effects = ServerSCLHandlerValueRequest.getEffects(graph, anyFunction);
 
-       final Function1<CommandContext, CommandResult> fn = anyFunction.getValue(graph);
-        String expression = anyFunction.getPropertyValue(graph, "expression");
+       Function1<CommandContext, CommandResult> fn = anyFunction.getValue(graph);
+        //String expression = anyFunction.getPropertyValue(graph, "expression");
 
        final Session session = graph.getSession();
 
-        return new AbstractResponseHandler(expression) {
+        return new AbstractResponseHandler(fn) {
 
                private String formatError(RequestProcessor proc, Throwable t) {
 
index cf20ca670f444e0a28dbaa48df83e1ea7bbf987e..a9118604fb1d11fdb1adca1898c823473ebeb7d9 100644 (file)
@@ -1,18 +1,22 @@
 package org.simantics.document.server.handler;
 
+import org.simantics.document.server.io.CommandContext;
+import org.simantics.document.server.io.CommandResult;
+import org.simantics.scl.runtime.function.Function1;
+
 public abstract class AbstractResponseHandler extends AbstractEventHandler {
 
-       private String expression;
+       private Function1<CommandContext, CommandResult> fn;
        
-       public AbstractResponseHandler(String expression) {
-               this.expression = expression;
+       public AbstractResponseHandler(Function1<CommandContext, CommandResult> fn) {
+               this.fn = fn;
        }
 
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
-               result = prime * result + ((expression == null) ? 0 : expression.hashCode());
+               result = prime * result + ((fn == null) ? 0 : fn.hashCode());
                return result;
        }
 
@@ -25,10 +29,10 @@ public abstract class AbstractResponseHandler extends AbstractEventHandler {
                if (getClass() != obj.getClass())
                        return false;
                AbstractResponseHandler other = (AbstractResponseHandler) obj;
-               if (expression == null) {
-                       if (other.expression != null)
+               if (fn == null) {
+                       if (other.fn != null)
                                return false;
-               } else if (!expression.equals(other.expression))
+               } else if (!fn.equals(other.fn))
                        return false;
                return true;
        }