1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. 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 implementation
10 Vicente Fernando - www.alfersoft.com.ar
11 **********************************************************************/
12 package net.sourceforge.phpdt.internal.debug.core.model;
14 import org.eclipse.debug.core.DebugException;
15 import org.eclipse.debug.core.ILaunch;
16 import org.eclipse.debug.core.model.IDebugTarget;
17 import org.eclipse.debug.core.model.IValue;
18 import org.eclipse.debug.core.model.IVariable;
21 * @author Administrator
23 * To change this generated comment edit the template variable "typecomment":
24 * Window>Preferences>Java>Templates.
25 * To enable and disable the creation of type comments go to
26 * Window>Preferences>Java>Code Generation.
28 public class PHPValue implements IValue {
30 private String valueString ;
31 private String referenceTypeName ;
32 private boolean hasChildren= false ;
33 private PHPVariable owner ;
34 private PHPVariable[] variables ;
36 public PHPValue(PHPVariable owner) {
37 this(owner, "nil", null, false) ;
40 public PHPValue(PHPVariable owner, String valueString, String type, boolean hasChildren) {
41 this.valueString = valueString ;
43 this.hasChildren = hasChildren ;
44 this.referenceTypeName = type ;
49 * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
51 public String getReferenceTypeName() {
52 return this.referenceTypeName;
56 * @see org.eclipse.debug.core.model.IValue#getValueString()
58 public String getValueString() {
63 * @see org.eclipse.debug.core.model.IValue#isAllocated()
65 public boolean isAllocated() throws DebugException {
70 * @see org.eclipse.debug.core.model.IValue#getVariables()
72 public IVariable[] getVariables() throws DebugException {
74 return new PHPVariable[0] ;
76 if (variables == null) {
77 variables = ((PHPDebugTarget) this.getDebugTarget()).getPHPDBGProxy().readInstanceVariables(owner);
83 * @see org.eclipse.debug.core.model.IValue#hasVariables()
85 public boolean hasVariables() throws DebugException {
90 * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
92 public String getModelIdentifier() {
93 return owner.getModelIdentifier();
97 * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
99 public IDebugTarget getDebugTarget() {
100 return owner.getDebugTarget();
104 * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
106 public ILaunch getLaunch() {
107 return this.getDebugTarget().getLaunch();
111 * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
113 public Object getAdapter(Class adapter) {
117 public String toString() {
118 if (this.getReferenceTypeName() == null) {
119 return this.getValueString() ;
121 return this.getValueString() ;