01: package org.drools.eclipse.debug.core;
02:
03: import org.drools.eclipse.DroolsEclipsePlugin;
04: import org.eclipse.core.resources.IWorkspaceRunnable;
05: import org.eclipse.core.resources.ResourcesPlugin;
06: import org.eclipse.core.runtime.CoreException;
07: import org.eclipse.core.runtime.IProgressMonitor;
08: import org.eclipse.debug.core.ILaunch;
09: import org.eclipse.debug.core.model.IDebugTarget;
10: import org.eclipse.debug.core.model.IProcess;
11: import org.eclipse.jdt.debug.core.IJavaDebugTarget;
12:
13: import com.sun.jdi.VirtualMachine;
14:
15: public class DroolsDebugModel {
16:
17: private DroolsDebugModel() {
18: }
19:
20: public static IDebugTarget newDebugTarget(ILaunch launch,
21: VirtualMachine vm, String name, IProcess process,
22: boolean allowTerminate, boolean allowDisconnect) {
23: return newDebugTarget(launch, vm, name, process,
24: allowTerminate, allowDisconnect, true);
25: }
26:
27: public static IDebugTarget newDebugTarget(final ILaunch launch,
28: final VirtualMachine vm, final String name,
29: final IProcess process, final boolean allowTerminate,
30: final boolean allowDisconnect, final boolean resume) {
31: final IJavaDebugTarget[] target = new IJavaDebugTarget[1];
32: IWorkspaceRunnable r = new IWorkspaceRunnable() {
33: public void run(IProgressMonitor m) {
34: target[0] = new DroolsDebugTarget(launch, vm, name,
35: allowTerminate, allowDisconnect, process,
36: resume);
37: }
38: };
39: try {
40: ResourcesPlugin.getWorkspace().run(r, null, 0, null);
41: } catch (CoreException exc) {
42: DroolsEclipsePlugin.log(exc);
43: }
44: return target[0];
45: }
46:
47: }
|