1 package org.simantics.structural.synchronization.utils;
3 import java.util.Collection;
5 import org.simantics.structural.synchronization.protocol.ChildInfo;
6 import org.simantics.structural.synchronization.protocol.Connection;
7 import org.simantics.structural.synchronization.protocol.SerializedVariable;
8 import org.simantics.structural.synchronization.protocol.SynchronizationEventHandler;
9 import org.simantics.structural.synchronization.protocol.SynchronizationException;
11 public class DiagnosticSynchronizationEventHandler implements SynchronizationEventHandler {
16 public void beginSynchronization() {
20 public void endSynchronization() {
24 public void beginComponent(String name, String typeId,
25 Collection<SerializedVariable> properties,
26 Collection<Connection> connections, Collection<ChildInfo> children)
27 throws SynchronizationException {
28 for(int i=0;i<indentation;++i)
29 System.out.print(" ");
30 System.out.print(name);
32 System.out.print(" :: " + typeId);
34 for(SerializedVariable var : properties) {
35 for(int i=0;i<=indentation;++i)
36 System.out.print(" ");
37 System.out.println(SerializedVariable.print(var, indentation*2+2));
39 for(Connection connection : connections) {
40 for(int i=0;i<=indentation;++i)
41 System.out.print(" ");
42 System.out.println(connection);
44 if(!children.isEmpty()) {
45 for(int i=0;i<=indentation;++i)
46 System.out.print(" ");
47 System.out.print("Children ");
49 System.out.println(children);
55 public void endComponent() {
60 public void beginType(String id, Collection<SerializedVariable> properties) {
61 System.out.println("--- Type " + id + " --------------------------------");
62 for(SerializedVariable var : properties)
63 System.out.println(SerializedVariable.print(var, 2));
67 public void endType() {
68 System.out.println("----------------------------------------------------");
72 public void reportProblem(String description) {
73 System.err.println(description);
77 public void reportProblem(String description, Exception e) {
78 System.err.println(description);