1 /*******************************************************************************
2 * Copyright (c) 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 * Bjorn Freeman-Benson - initial API and implementation
11 *******************************************************************************/
12 package net.sourceforge.phpdt.internal.debug.core.model;
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.PlatformObject;
16 import org.eclipse.core.runtime.Status;
17 import org.eclipse.debug.core.DebugEvent;
18 import org.eclipse.debug.core.DebugException;
19 import org.eclipse.debug.core.DebugPlugin;
20 import org.eclipse.debug.core.ILaunch;
21 import org.eclipse.debug.core.model.IDebugElement;
22 import org.eclipse.debug.core.model.IDebugTarget;
25 * Common function of PHP debug model elements
27 public abstract class PHPDebugElement extends PlatformObject implements
31 protected PHPDebugTarget fTarget;
34 * Constructs a new debug element contained in the given debug target.
37 * debug target (PHP VM)
39 public PHPDebugElement(PHPDebugTarget target) {
46 * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
48 public String getModelIdentifier() {
50 // return PHPDebugCorePlugin.PLUGIN_ID;
51 // return IPDAConstants.ID_PDA_DEBUG_MODEL;
57 * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
59 public IDebugTarget getDebugTarget() {
66 * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
68 public ILaunch getLaunch() {
69 return getDebugTarget().getLaunch();
75 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
77 public Object getAdapter(Class adapter) {
78 if (adapter == IDebugElement.class) {
81 return super.getAdapter(adapter);
84 protected void abort(String message, Throwable e) throws DebugException {
85 throw new DebugException(
88 null /* DebugExamplesPlugin.getDefault().getDescriptor().getUniqueIdentifier() */,
89 DebugPlugin.INTERNAL_ERROR, message, e));
96 * the event to be fired
98 protected void fireEvent(DebugEvent event) {
99 DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { event });
103 * Fires a <code>CREATE</code> event for this element.
105 protected void fireCreationEvent() {
106 fireEvent(new DebugEvent(this, DebugEvent.CREATE));
110 * Fires a <code>RESUME</code> event for this element with the given
116 public void fireResumeEvent(int detail) {
117 fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
121 * Fires a <code>SUSPEND</code> event for this element with the given
127 public void fireSuspendEvent(int detail) {
128 fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
132 * Fires a <code>TERMINATE</code> event for this element.
134 protected void fireTerminateEvent() {
135 fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));