1 7 34 35 package com.sun.tools.example.debug.gui; 36 37 import java.io.*; 38 import java.util.*; 39 40 import com.sun.jdi.*; 41 import com.sun.tools.example.debug.bdi.*; 42 43 public class Environment { 44 45 private SourceManager sourceManager; 46 private ClassManager classManager; 47 private ContextManager contextManager; 48 private MonitorListModel monitorListModel; 49 private ExecutionManager runtime; 50 51 private PrintWriter typeScript; 52 53 private boolean verbose; 54 55 public Environment() { 56 this.classManager = new ClassManager(this); 57 this.runtime = new ExecutionManager(); 59 this.sourceManager = new SourceManager(this); 60 this.contextManager = new ContextManager(this); 61 this.monitorListModel = new MonitorListModel(this); 62 } 63 64 66 public SourceManager getSourceManager() { 67 return sourceManager; 68 } 69 70 public ClassManager getClassManager() { 71 return classManager; 72 } 73 74 public ContextManager getContextManager() { 75 return contextManager; 76 } 77 78 public MonitorListModel getMonitorListModel() { 79 return monitorListModel; 80 } 81 82 public ExecutionManager getExecutionManager() { 83 return runtime; 84 } 85 86 99 public void terminate() { 100 System.exit(0); 101 } 102 103 105 106 109 112 public void setTypeScript(PrintWriter writer) { 113 typeScript = writer; 114 } 115 116 public void error(String message) { 117 if (typeScript != null) { 118 typeScript.println(message); 119 } else { 120 System.out.println(message); 121 } 122 } 123 124 public void failure(String message) { 125 if (typeScript != null) { 126 typeScript.println(message); 127 } else { 128 System.out.println(message); 129 } 130 } 131 132 public void notice(String message) { 133 if (typeScript != null) { 134 typeScript.println(message); 135 } else { 136 System.out.println(message); 137 } 138 } 139 140 public OutputSink getOutputSink() { 141 return new OutputSink(typeScript); 142 } 143 144 public void viewSource(String fileName) { 145 com.sun.tools.example.debug.gui.GUI.srcTool.showSourceFile(fileName); 148 } 149 150 public void viewLocation(Location locn) { 151 com.sun.tools.example.debug.gui.GUI.srcTool.showSourceForLocation(locn); 155 } 156 157 159 public boolean getVerboseFlag() { 160 return verbose; 161 } 162 163 public void setVerboseFlag(boolean verbose) { 164 this.verbose = verbose; 165 } 166 167 } 168 | Popular Tags |