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 IDebugElement {
30 protected PHPDebugTarget fTarget;
33 * Constructs a new debug element contained in the given
36 * @param target debug target (PHP VM)
38 public PHPDebugElement(PHPDebugTarget target) {
43 * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
45 public String getModelIdentifier() {
47 // return PHPDebugCorePlugin.PLUGIN_ID;
48 // return IPDAConstants.ID_PDA_DEBUG_MODEL;
51 * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
53 public IDebugTarget getDebugTarget() {
57 * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
59 public ILaunch getLaunch() {
60 return getDebugTarget().getLaunch();
63 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
65 public Object getAdapter(Class adapter) {
66 if (adapter == IDebugElement.class) {
69 return super.getAdapter(adapter);
72 protected void abort(String message, Throwable e) throws DebugException {
73 throw new DebugException(new Status(IStatus.ERROR, null /*DebugExamplesPlugin.getDefault().getDescriptor().getUniqueIdentifier()*/,
74 DebugPlugin.INTERNAL_ERROR, message, e));
80 * @param event the event to be fired
82 protected void fireEvent(DebugEvent event) {
83 DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
87 * Fires a <code>CREATE</code> event for this element.
89 protected void fireCreationEvent() {
90 fireEvent(new DebugEvent(this, DebugEvent.CREATE));
94 * Fires a <code>RESUME</code> event for this element with
97 * @param detail event detail code
99 public void fireResumeEvent(int detail) {
100 fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
104 * Fires a <code>SUSPEND</code> event for this element with
107 * @param detail event detail code
109 public void fireSuspendEvent(int detail) {
110 fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
114 * Fires a <code>TERMINATE</code> event for this element.
116 protected void fireTerminateEvent() {
117 fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));