public void RegisterYComp(YCompClient ycompClient) { if (this.ycompStream != null) { throw new Exception("there is already a ycomp stream registered"); } this.ycompStream = ycompClient.ycompStream; foreach (NodeRealizer nr in registeredNodeRealizers.Keys) { ycompStream.Write("addNodeRealizer \"" + nr.Name + "\" \"" + VCGDumper.GetColor(nr.BorderColor) + "\" \"" + VCGDumper.GetColor(nr.Color) + "\" \"" + VCGDumper.GetColor(nr.TextColor) + "\" \"" + VCGDumper.GetNodeShape(nr.Shape) + "\"\n"); } foreach (EdgeRealizer er in registeredEdgeRealizers.Keys) { ycompStream.Write("addEdgeRealizer \"" + er.Name + "\" \"" + VCGDumper.GetColor(er.Color) + "\" \"" + VCGDumper.GetColor(er.TextColor) + "\" \"" + er.LineWidth + "\" \"" + VCGDumper.GetLineStyle(er.LineStyle) + "\"\n"); } }
/// <summary> /// Ensures that the yComp display is up to date, prints out a message, and waits for a key press. /// </summary> /// <param name="text">The message to be printed.</param> private static void PrintAndWait(String text, YCompClient ycomp) { ycomp.UpdateDisplay(); ycomp.Sync(); Console.WriteLine(text); Console.WriteLine("Press a key to continue..."); Console.ReadKey(true); }
/// <summary> /// Uploads the graph to YComp, updates the display and makes a synchonisation /// </summary> public static void UploadGraph(IGraph graph, YCompClient ycompClient) { foreach(INode node in graph.Nodes) ycompClient.AddNode(node); foreach(IEdge edge in graph.Edges) ycompClient.AddEdge(edge); ycompClient.UpdateDisplay(); ycompClient.Sync(); }
public void AnnotateGraphElements(YCompClient ycompClient) { foreach (KeyValuePair <INode, string> nodeToName in annotatedNodes) { ycompClient.AnnotateElement(nodeToName.Key, nodeToName.Value); } foreach (KeyValuePair <IEdge, string> edgeToName in annotatedEdges) { ycompClient.AnnotateElement(edgeToName.Key, edgeToName.Value); } }
public Highlighter(IDebuggerEnvironment env, ShellGraphProcessingEnvironment shellProcEnv, ElementRealizers realizers, GraphAnnotationAndChangesRecorder renderRecorder, YCompClient ycompClient, Stack <Sequence> debugSequences ) { this.env = env; this.shellProcEnv = shellProcEnv; this.realizers = realizers; this.renderRecorder = renderRecorder; this.ycompClient = ycompClient; this.debugSequences = debugSequences; }
// applies changes recorded so far, leaving a graph without visible changes behind (e.g. no annotations) public void ApplyChanges(YCompClient ycompClient) { foreach (INode node in addedNodes.Keys) { ycompClient.ChangeNode(node, null); ycompClient.AnnotateElement(node, null); } foreach (IEdge edge in addedEdges.Keys) { ycompClient.ChangeEdge(edge, null); ycompClient.AnnotateElement(edge, null); } foreach (String edgeName in deletedEdges) { ycompClient.DeleteEdge(edgeName); } foreach (String nodeName in deletedNodes) { ycompClient.DeleteNode(nodeName); } foreach (INode node in retypedNodes.Keys) { ycompClient.ChangeNode(node, null); } foreach (IEdge edge in retypedEdges.Keys) { ycompClient.ChangeEdge(edge, null); } foreach (INode node in annotatedNodes.Keys) { ycompClient.AnnotateElement(node, null); } foreach (IEdge edge in annotatedEdges.Keys) { ycompClient.AnnotateElement(edge, null); } }
public MatchMarkerAndAnnotator(ElementRealizers realizers, GraphAnnotationAndChangesRecorder renderRecorder, YCompClient ycompClient) { this.realizers = realizers; this.renderRecorder = renderRecorder; this.ycompClient = ycompClient; }
/// <summary> /// Closes the debugger. /// </summary> public void Close() { if(ycompClient == null) throw new InvalidOperationException("The debugger has already been closed!"); UnregisterLibGrEvents(shellProcEnv.ProcEnv.NamedGraph); shellProcEnv.ProcEnv.NamedGraph.ReuseOptimization = true; ycompClient.Close(); ycompClient = null; viewerProcess.Close(); viewerProcess = null; }
/// <summary> /// Initializes a new Debugger instance using the given layout and options. /// Any invalid options will be removed from layoutOptions. /// </summary> /// <param name="grShellImpl">An GrShellImpl instance.</param> /// <param name="debugLayout">The name of the layout to be used.</param> /// <param name="layoutOptions">An dictionary mapping layout option names to their values. /// It may be null, if no options are to be applied.</param> public Debugger(GrShellImpl grShellImpl, String debugLayout, Dictionary<String, String> layoutOptions) { this.grShellImpl = grShellImpl; this.shellProcEnv = grShellImpl.CurrentShellProcEnv; this.realizers = grShellImpl.realizers; this.context = new PrintSequenceContext(grShellImpl.Workaround); int ycompPort = GetFreeTCPPort(); if(ycompPort < 0) { throw new Exception("Didn't find a free TCP port in the range 4242-4251!"); } try { viewerProcess = Process.Start(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar + "ycomp", "--nomaximize -p " + ycompPort); } catch(Exception e) { throw new Exception("Unable to start yComp: " + e.ToString()); } try { ycompClient = new YCompClient(shellProcEnv.ProcEnv.NamedGraph, debugLayout, 20000, ycompPort, shellProcEnv.DumpInfo, realizers); } catch(Exception ex) { throw new Exception("Unable to connect to yComp at port " + ycompPort + ": " + ex.Message); } shellProcEnv.ProcEnv.NamedGraph.ReuseOptimization = false; NotifyOnConnectionLost = true; try { if(layoutOptions != null) { List<String> illegalOptions = null; foreach(KeyValuePair<String, String> option in layoutOptions) { if(!SetLayoutOption(option.Key, option.Value)) { if(illegalOptions == null) illegalOptions = new List<String>(); illegalOptions.Add(option.Key); } } if(illegalOptions != null) { foreach(String illegalOption in illegalOptions) layoutOptions.Remove(illegalOption); } } if(!ycompClient.dumpInfo.IsExcludedGraph()) UploadGraph(shellProcEnv.ProcEnv.NamedGraph); } catch(OperationCanceledException) { throw new Exception("Connection to yComp lost"); } NotifyOnConnectionLost = false; RegisterLibGrEvents(shellProcEnv.ProcEnv.NamedGraph); }