/********************************************************************** Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/cpl-v10.html Contributors: IBM Corporation - Initial implementation Vicente Fernando - www.alfersoft.com.ar **********************************************************************/ package net.sourceforge.phpdt.internal.debug.core.model; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IVariable; /** * @author Administrator * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class PHPValue implements IValue { private String valueString ; private String referenceTypeName ; private boolean hasChildren= false ; private PHPVariable owner ; private PHPVariable[] variables ; public PHPValue(PHPVariable owner) { this(owner, "nil", null, false) ; } public PHPValue(PHPVariable owner, String valueString, String type, boolean hasChildren) { this.valueString = valueString ; this.owner = owner ; this.hasChildren = hasChildren ; this.referenceTypeName = type ; } /** * @see org.eclipse.debug.core.model.IValue#getReferenceTypeName() */ public String getReferenceTypeName() { return this.referenceTypeName; } /** * @see org.eclipse.debug.core.model.IValue#getValueString() */ public String getValueString() { return valueString; } /** * @see org.eclipse.debug.core.model.IValue#isAllocated() */ public boolean isAllocated() throws DebugException { return false; } /** * @see org.eclipse.debug.core.model.IValue#getVariables() */ public IVariable[] getVariables() throws DebugException { if (!hasChildren) { return new PHPVariable[0] ; } if (variables == null) { variables = ((PHPDebugTarget) this.getDebugTarget()).getPHPDBGProxy().readInstanceVariables(owner); } return variables; } /** * @see org.eclipse.debug.core.model.IValue#hasVariables() */ public boolean hasVariables() throws DebugException { return hasChildren; } /** * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier() */ public String getModelIdentifier() { return owner.getModelIdentifier(); } /** * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget() */ public IDebugTarget getDebugTarget() { return owner.getDebugTarget(); } /** * @see org.eclipse.debug.core.model.IDebugElement#getLaunch() */ public ILaunch getLaunch() { return this.getDebugTarget().getLaunch(); } /** * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) */ public Object getAdapter(Class adapter) { return null; } public String toString() { if (this.getReferenceTypeName() == null) { return this.getValueString() ; } return this.getValueString() ; } }