1 24 package org.aspectj.debugger.ide; 25 26 import org.aspectj.debugger.base.DebuggerException; 27 import org.aspectj.debugger.base.NoVMException; 28 import org.aspectj.debugger.gui.AJUtil; 29 import org.aspectj.debugger.gui.ComponentDirector; 30 import java.io.File ; 31 import java.util.*; 32 33 public class IDEComponentDirector extends ComponentDirector { 34 35 public static IDEComponentDirector proto; 36 37 protected IDEInterface ide; 38 39 public IDEComponentDirector(String title, String mode, IDEInterface ide) { 40 super(title, mode); 41 if (ide == null) { 42 ide = new IDEInterfaceImpl(); 43 } 44 this.ide = ide; 45 } 46 47 public void go() { 48 if (proto != null) { 49 AJUtil.info("Only one debugger may run at once"); 50 getGUIDebugger().exit(); 51 return; 52 } 53 proto = this; 54 super.go(); 55 } 56 57 public void showBreakpointDialog() { 58 59 } 60 61 public void finishUp() { 62 setBreakpoints(); 63 } 64 65 public void title(String msg) {} 66 public final void title() { 67 title(""); 68 } 69 70 public IDEInterface getIde() { 71 return ide; 72 } 73 74 protected void setBreakpoints() { 75 ((IDEInterfaceHelper)getIde()).settingBreakpointsFromIDE(); 76 try { 77 setBreakpoints_(); 78 } catch (Exception t) { 79 getGUIDebugger().getDebugger().handle(t); 80 } finally { 81 ((IDEInterfaceHelper)getIde()).doneSettingBreakpointsFromIDE(); 82 } 83 } 84 85 protected void setBreakpoints_() { 86 Iterator iter = ide.getInitialBreakpoints().iterator(); 87 while (iter.hasNext()) { 88 IDEInterface.SourceLineBreakable request = (IDEInterface.SourceLineBreakable)iter.next(); 89 try { 90 String source = request.getSourceName(); 92 int line = request.getLine(); 93 getDebugger().stopOnCommand(source, line); 94 } catch (DebuggerException de) { 95 getGUIDebugger().handleDebuggerException(de); 96 } 97 } 98 } 99 100 public void shutDown() { 101 proto = null; 102 super.shutDown(); 103 } 104 } 105 | Popular Tags |