* Window - Preferences - Java - Code Style - Code Templates
*/
public class XDebugVariable extends XDebugElement implements IVariable {
- private String fName;
- private XDebugStackFrame fFrame;
+ private String fName;
+ private String fNameFull;
+ private XDebugStackFrame fFrame;
private XDebugAbstractValue fValue;
- private String fFacet;
+ private String fFacet;
+ private XDebugVariable fParent; // The parent variable (a back link)
+
/**
* Constructs a variable contained in the given stack frame
* @param frame owning stack frame
* @param name variable name
*/
- public XDebugVariable(XDebugStackFrame frame, Node property) throws DebugException {
+ public XDebugVariable(XDebugStackFrame frame, Node property, XDebugVariable parent) throws DebugException {
super((XDebugTarget) frame.getDebugTarget());
+
+ this.fParent = parent;
+
if (frame != null ) {
fFrame = frame;
}
- fName = PHPDebugUtils.getAttributeValue(property,"name");
+ if (parent == null) {
+ fName = "$" + PHPDebugUtils.getAttributeValue(property,"name"); // Prepend the variable 'short' name with the php variable prefix '$'
+ }
+ else {
+ fName = PHPDebugUtils.getAttributeValue(property,"name"); // If this is the root variable don't prepend prefix '$'
+ }
+
+ fNameFull = PHPDebugUtils.getAttributeValue(property,"fullname"); // The fullname has the '$' prepended, but it is the fully qualified name
+ // e.g. $myvar->child->a_variable. The fullname would be suitable to take for
+ // the setting a watch expression
+
if ("".equals(fName)) {
fName = PHPDebugUtils.getAttributeValue(property,"address");
}
else if (typeName.equals("string") )
fValue = new XDebugStringValue(frame, property);
else if (typeName.equals("array") )
- fValue = new XDebugArrayValue(frame, property);
- else if (typeName.equals("hash") )
- fValue = new XDebugArrayValue(frame, property);
+ fValue = new XDebugArrayValue(frame, property, this);
else if (typeName.equals("object") )
- fValue = new XDebugArrayValue(frame, property);
+ fValue = new XDebugObjectValue(frame, property, this);
else if (typeName.equals("resource") )
fValue = new XDebugResourceValue(frame, property);
else
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getValue()
*/
- public IValue getValue() throws DebugException {
+ public IValue getValue() {
return fValue;
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getName()
*/
- public String getName() throws DebugException {
+ public String getName() {
return fName;
}
+ /*
+ * @return The fully qualified name of the variable
+ */
+ public String getNameFull () {
+ return fNameFull;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IVariable#getReferenceTypeName()
*/
public void setValue(IValue value) throws DebugException {
}
+ /**
+ *
+ * @param changed This method is called after a suspend when the list of
+ * variables is updated, to mark that this variable has a changed
+ * value. The variable view will show this variable in
+ * a different color.
+ */
+ public void setValueChanged(boolean changed) {
+ fValue.setChanged(changed);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
*/
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(java.lang.String)
*/
public boolean verifyValue(String expression) throws DebugException {
- return fValue.verifyValue(expression);
+ /*return true; */return fValue.verifyValue(expression);
}
/* (non-Javadoc)
public String getVisibility() {
return fFacet;
}
+
+ /**
+ *
+ */
+ public XDebugVariable getParent() {
+ return fParent;
+ }
+
+ /**
+ *
+ */
+ public void setParent(XDebugVariable parent) {
+ this.fParent = parent;
+ }
}
\ No newline at end of file