| 1 22 23 package org.aspectj.debugger.gui; 24 25 import org.aspectj.debugger.base.*; 26 import org.aspectj.debugger.ide.*; 27 import org.aspectj.util.gui.*; 28 29 import com.sun.jdi.*; 30 import java.awt.*; 31 import java.awt.event.*; 32 import java.io.*; 33 import java.util.*; 34 import javax.swing.*; 35 36 public class ComponentRepository { 37 38 private static StackTablePane stackTablePane = null; 39 private static CommandLine commandLine = null; 40 private static OutputTextArea outputTextArea = null; 41 private static EnvTextArea envTextArea = null; 42 private static AbstractSourcePane sourcePane = null; 43 private static AJThreadGroupTreePane threadGroupTreePane = null; 45 private static BreakpointTreePane breakpointTreePane = null; 46 private static ComponentDirector gui = null; 47 private static AJToolBar toolbar = null; 48 private static AJMenuBar menuBar = null; 50 private static ColorChangingLabel statusLabel = null; 51 private static GUIDebugger guiDebugger = null; 52 private static AJDebugger debugger = null; 53 private static WatchpointTreePane watchpointTreePane = null; 54 private static VariablesTreePane variablesTreePane = null; 55 56 static boolean debug = false; 57 static void db(Object o) { 58 if (debug) { 59 System.err.println("<DEBUG> " +o); 60 } 61 } 62 63 private static String [] tasks = null; 64 private static void initTasks() { 65 tasks = new String [] { 66 AJIcons.d(), 67 GUIDebugger.d(), 68 AJDebugger.d(), 69 OutputTextArea.d(), 70 StackTablePane.d(), 71 CommandLine.d(), 72 EnvTextArea.d(), 73 SourcePane.d(), 74 AJThreadGroupTreePane.d(), 76 BreakpointTreePane.d(), 77 WatchpointTreePane.d(), 78 VariablesTreePane.d(), 79 AJToolBar.d(), 80 AJMenuBar.d(), 82 ComponentDirector.d(), 83 }; 84 } 85 static { 86 initTasks(); 87 } 88 89 90 private final static int LAGER_WIDTH = 300; 91 private final static int LAGER_HEIGHT = 30; 92 private static class Lager { private JLabel[] labels; 94 private int times[]; 95 private int task = 0; 96 private final static Color defaultColor = new JLabel().getForeground(); 97 public Lager(String [] tasks) { 98 103 } 116 private JPanel panel() { 123 JPanel p = new JPanel(); 124 p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); 125 p.setBorder(BorderFactory.createEtchedBorder()); 126 return p; 127 } 128 public void log(Object str) { 143 task++; 146 } 147 private void unhighlight(JLabel label) { 148 Font f = label.getFont(); 149 f = new Font(f.getName(), Font.BOLD, f.getSize()); 150 label.setFont(f); 151 label.setForeground(defaultColor.darker()); 152 } 153 private void highlight(JLabel label) { 154 Font f = label.getFont(); 155 f = new Font(f.getName(), Font.BOLD | Font.ITALIC, f.getSize()); 156 label.setFont(f); 157 label.setForeground(defaultColor.darker().darker().darker()); 158 } 159 private boolean checkTask(int t) { 160 return t > -1 && t < tasks.length; 161 } 162 public void start() { 163 if (!Modes.isJBuilder() && !Modes.isForte()) { 164 } 167 } 168 public void done() { 169 } 172 } 173 private static Lager lager = new Lager(tasks); 174 private static void startLogging() { 175 lager.start(); 176 } 177 private static void doneLogging() { 178 lager.done(); 179 } 180 private static void task() { 181 lager.log(null); 182 } 183 184 private static boolean ide() { 185 return Modes.isIde(); 186 } 188 189 public final static void init(ComponentDirector gui, 190 GUIDebugger _guiDebugger, 191 AbstractSourcePane _sourcePane, 192 boolean _debug) { 193 startLogging(); 194 debug = _debug; 195 task(); AJIcons.init(); 196 task(); guiDebugger = _guiDebugger; 197 guiDebugger.setGui(gui); 198 task(); debugger = guiDebugger.getDebugger(); 199 task(); outputTextArea = new OutputTextArea(guiDebugger); 200 gui.setPrintStream(outputTextArea.getPrintStream()); 201 task(); stackTablePane = new StackTablePane(guiDebugger); 202 task(); commandLine = new CommandLine(gui); 203 task(); envTextArea = new EnvTextArea(guiDebugger); 204 task(); sourcePane = _sourcePane; 205 task(); threadGroupTreePane = new AJThreadGroupTreePane(guiDebugger); 207 task(); breakpointTreePane = new BreakpointTreePane(gui, guiDebugger); 208 task(); watchpointTreePane = new WatchpointTreePane(gui, guiDebugger); 209 task(); variablesTreePane = new VariablesTreePane(gui, guiDebugger); 210 task(); toolbar = new AJToolBar(guiDebugger); 211 task(); if (!ide()) { menuBar = new AJMenuBar(guiDebugger); } 213 statusLabel = commandLine.getStatusLabel(); 214 task(); ComponentRepository.gui = gui; 215 doneLogging(); 216 } 217 218 public static void init(ComponentDirector gui, GUIDebugger _guiDebugger, 219 AbstractSourcePane _sourcePane) { 220 init(gui, _guiDebugger, _sourcePane, false); 221 } 222 223 public static void init(ComponentDirector gui, String [] args) { 224 GUIDebugger guid = new GUIDebugger(gui, args); 225 init(gui, guid, new SourcePane(guid)); 226 } 227 228 public static void execute(String cmd) { 229 getGUIDebugger().executeCommand(cmd); 230 } 231 232 public static StackTablePane getStackTablePane() { return stackTablePane; } 233 public static CommandLine getCommandLine() { return commandLine; } 234 public static OutputTextArea getOutputTextArea() { return outputTextArea; } 235 public static EnvTextArea getEnvTextArea() { return envTextArea; } 236 public static AbstractSourcePane getSourcePane() { return sourcePane; } 237 public static AJThreadGroupTreePane getThreadGroupTreePane() { return threadGroupTreePane; } 239 public static BreakpointTreePane getBreakpointTreePane() { return breakpointTreePane; } 240 public static Frame getFrame() { return gui; } 241 public static ComponentDirector getComponentDirector() { return gui; } 242 public static AJToolBar getToolBar() { return toolbar; } 243 public static AJMenuBar getMenuBar() { return menuBar; } 245 public static ColorChangingLabel getStatusLabel() { return statusLabel; } 246 public static GUIDebugger getGUIDebugger() { return guiDebugger; } 247 public static AJDebugger getAJDebugger() { return debugger; } 248 public static VirtualMachine vm() throws NoVMException { return getAJDebugger().getVM(); } 249 public static WatchpointTreePane getWatchpointTreePane() { return watchpointTreePane; } 250 public static VariablesTreePane getVariablesTreePane() { return variablesTreePane; } 251 252 } 257 | Popular Tags |