]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
More console printing 36/536/2
authorAntti Villberg <antti.villberg@semantum.fi>
Fri, 19 May 2017 11:25:45 +0000 (14:25 +0300)
committerJani Simomaa <jani.simomaa@semantum.fi>
Mon, 22 May 2017 08:01:13 +0000 (11:01 +0300)
refs #7226

Change-Id: I255d30cc7188e6aff2111952b1a37ee4c755be68

bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/IConsoleSupport.java [new file with mode: 0644]
bundles/org.simantics.document.server/src/org/simantics/document/server/ConsoleSCLReportingHandler.java [new file with mode: 0644]
bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java

diff --git a/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/IConsoleSupport.java b/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/IConsoleSupport.java
new file mode 100644 (file)
index 0000000..facc7b4
--- /dev/null
@@ -0,0 +1,10 @@
+package org.simantics.document.server.io;
+
+import java.util.Collection;
+
+public interface IConsoleSupport {
+       void registerConsole(String sessionGUID, IConsole console);
+       IConsole getConsole(String sessionGUID);
+       IConsole findConsole(String consoleGUID);
+       Collection<IConsole> getConsoles();
+}
diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/ConsoleSCLReportingHandler.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/ConsoleSCLReportingHandler.java
new file mode 100644 (file)
index 0000000..e227a89
--- /dev/null
@@ -0,0 +1,34 @@
+package org.simantics.document.server;
+
+import org.simantics.document.server.io.IConsole;
+import org.simantics.scl.runtime.reporting.SCLReportingHandler;
+
+public class ConsoleSCLReportingHandler implements SCLReportingHandler {
+
+       private final IConsole console;
+
+       public ConsoleSCLReportingHandler(IConsole console) {
+               this.console = console;
+       }
+
+       @Override
+       public void print(String text) {
+               console.addMessage(text);
+       }
+
+       @Override
+       public void printError(String error) {
+               console.addMessage(error);
+       }
+
+       @Override
+       public void printCommand(String command) {
+               console.addMessage(command);
+       }
+
+       @Override
+       public void didWork(double amount) {
+               console.addMessage("didWork " + amount);
+       }
+
+}
\ No newline at end of file
index 20fa2a71b7b272cec574e351c715a17c25479f04..d0ec54557353555349b5e66f222002b8c86f15ed 100644 (file)
@@ -1173,35 +1173,5 @@ public class Functions {
        return graph.syncRequest(new PathExistsRequest(context));
     }
     
-       static class ConsoleSCLReportingHandler implements SCLReportingHandler {
-
-               private final IConsole console;
-
-               ConsoleSCLReportingHandler(IConsole console) {
-                       this.console = console;
-               }
-
-               @Override
-               public void print(String text) {
-                       console.addMessage(text);
-               }
-
-               @Override
-               public void printError(String error) {
-                       console.addMessage(error);
-               }
-
-               @Override
-               public void printCommand(String command) {
-                       console.addMessage(command);
-               }
-
-               @Override
-               public void didWork(double amount) {
-                       console.addMessage("didWork " + amount);
-               }
-
-       }
-    
     
 }
\ No newline at end of file