1 19 20 21 package ca.mcgill.sable.soot.cfg.editParts; 22 23 import org.eclipse.draw2d.AbstractLayout; 24 import org.eclipse.draw2d.IFigure; 25 import org.eclipse.draw2d.geometry.*; 26 import org.eclipse.draw2d.graph.*; 27 import java.util.*; 28 29 public class CFGGraphLayoutManager extends AbstractLayout { 30 31 private CFGGraphEditPart graphPart; 32 33 public CFGGraphLayoutManager(CFGGraphEditPart graphPart) { 34 setGraphPart(graphPart); 35 } 36 37 40 protected Dimension calculatePreferredSize( 41 IFigure arg0, 42 int arg1, 43 int arg2) { 44 return null; 45 } 46 47 50 public void layout(IFigure arg0) { 51 DirectedGraph graph = new DirectedGraph(); 52 HashMap map = new HashMap(); 53 getGraphPart().contributeNodesToGraph(graph, map); 56 getGraphPart().contributeEdgesToGraph(graph, map); 57 if (graph.nodes.size() != 0){ 58 DirectedGraphLayout layout = new DirectedGraphLayout(); 59 layout.visit(graph); 60 61 getGraphPart().applyGraphResults(graph, map); 62 } 63 64 } 65 66 69 public CFGGraphEditPart getGraphPart() { 70 return graphPart; 71 } 72 73 76 public void setGraphPart(CFGGraphEditPart part) { 77 graphPart = part; 78 } 79 80 } 81 | Popular Tags |