1 11 package org.eclipse.jdt.internal.debug.ui.monitors; 12 13 import org.eclipse.core.runtime.PlatformObject; 14 import org.eclipse.debug.core.DebugException; 15 import org.eclipse.debug.core.ILaunch; 16 import org.eclipse.debug.core.ILaunchConfiguration; 17 import org.eclipse.debug.core.model.IDebugElement; 18 import org.eclipse.debug.core.model.IDebugTarget; 19 import org.eclipse.debug.core.model.ITerminate; 20 21 26 public class JavaOwningThread extends PlatformObject implements IDebugElement, ITerminate { 27 28 31 private JavaMonitorThread fThread; 32 33 36 private JavaContendedMonitor fContendedMonitor; 37 40 private JavaContendedMonitor fParent; 41 42 47 public JavaOwningThread(JavaMonitorThread thread, JavaContendedMonitor parent) { 48 fThread= thread; 49 thread.addElement(this); 50 fParent= parent; 51 } 52 53 56 public JavaMonitorThread getThread() { 57 return fThread; 58 } 59 60 64 public JavaContendedMonitor getParent() { 65 return fParent; 66 } 67 68 public JavaContendedMonitor getContendedMonitor() { 69 JavaMonitor contendedMonitor= fThread.getContendedMonitor0(); 70 if (contendedMonitor == null) { 71 fContendedMonitor= null; 72 } else if (fContendedMonitor == null || fContendedMonitor.getMonitor() != contendedMonitor) { 73 fContendedMonitor= new JavaContendedMonitor(contendedMonitor, this); 75 } 76 return fContendedMonitor; 77 } 78 79 public void update() { 80 } 81 82 85 public String getModelIdentifier() { 86 return fThread.getModelIdentifier(); 87 } 88 89 92 public IDebugTarget getDebugTarget() { 93 return fThread.getDebugTarget(); 94 } 95 96 99 public ILaunch getLaunch() { 100 return fThread.getLaunch(); 101 } 102 103 106 public boolean isSuspended() { 107 return fThread.isSuspended(); 108 } 109 110 113 public Object getAdapter(Class adapter) { 114 if(adapter == IDebugTarget.class) { 115 return getDebugTarget(); 116 } 117 if(adapter.equals(ILaunchConfiguration.class)) { 119 return getLaunch().getLaunchConfiguration(); 120 } 121 return super.getAdapter(adapter); 122 } 123 124 127 public boolean canTerminate() { 128 return getDebugTarget().canTerminate(); 129 } 130 131 134 public boolean isTerminated() { 135 return getDebugTarget().isTerminated(); 136 } 137 138 141 public void terminate() throws DebugException { 142 getDebugTarget().terminate(); 143 } 144 145 } 146 | Popular Tags |