From: Antti Villberg Date: Fri, 19 May 2017 11:25:45 +0000 (+0300) Subject: More console printing X-Git-Tag: v1.29.0~40 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F536%2F2;p=simantics%2Fplatform.git More console printing refs #7226 Change-Id: I255d30cc7188e6aff2111952b1a37ee4c755be68 --- 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 index 000000000..facc7b403 --- /dev/null +++ b/bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/IConsoleSupport.java @@ -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 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 index 000000000..e227a89ca --- /dev/null +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/ConsoleSCLReportingHandler.java @@ -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 diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java index 20fa2a71b..d0ec54557 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java @@ -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