1 11 package org.eclipse.jdt.internal.debug.ui.monitors; 12 13 14 import org.eclipse.debug.core.DebugException; 15 import org.eclipse.debug.core.model.IThread; 16 import org.eclipse.jdt.debug.core.IJavaDebugTarget; 17 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; 18 import org.eclipse.jface.action.IAction; 19 20 21 24 public class MonitorQuitAction extends MonitorAction { 25 26 29 public void run(IAction action) { 30 IJavaDebugTarget target= getDebugTarget(); 31 if (target == null) { 32 return; 33 } 34 try { 35 IThread[] threads= target.getThreads(); 36 for (int i = 0; i < threads.length; i++) { 37 IThread thread= threads[i]; 38 if (thread.isSuspended()) { 39 thread.resume(); 40 while (thread.isSuspended()) { 41 Thread.sleep(100); 42 } 43 } 44 } 45 } 46 catch (DebugException e) { 47 JDIDebugUIPlugin.log(e); 48 } 49 catch (InterruptedException e){ 50 JDIDebugUIPlugin.log(e); 51 } 52 } 53 54 57 public void update() { 58 boolean enable= false; 59 if (fAction != null) { 60 IJavaDebugTarget target= getDebugTarget(); 61 if (target != null) { 62 if (target.supportsMonitorInformation()) { 63 try { 64 IThread[] threads= target.getThreads(); 65 for (int i = 0; i < threads.length; i++) { 66 IThread thread= threads[i]; 67 if (thread.isSuspended()) { 68 enable= true; 69 break; 70 } 71 } 72 }catch (DebugException e) { 73 } 74 } 75 } 76 fAction.setEnabled(enable); 77 } 78 } 79 } 80 | Popular Tags |