private PHPStackFrame fStackFrame; // The stackframe this variable belongs to
private PHPVariable fParent; // The parent variable (a back link)
private String fLongName; // The qualified name
+ private boolean fModifiable = true;
/**
*
*/
public void setParent(PHPVariable parent) {
this.fParent = parent;
- fLongName = parent.getLongName() + fName;
+
+ switch (fParent.getReferenceType()) {
+ case PHPValue.PEVT_ARRAY:
+ fLongName = fParent.getLongName() + fName;
+ break;
+ case PHPValue.PEVT_OBJECT:
+ fLongName = fParent.getLongName() + "->" + fName;
+ break;
+ default:
+ fLongName = fName;
+ break;
+ }
}
/**
}
}
- setValue(vars[0].fValue);
+ fValue = vars[0].fValue;
+
+ // set parent if new value has children
+ if (fValue.hasVariables()) {
+ Vector variables = fValue.getChildVariables();
+ for (int i = 0; i < variables.size(); i++) {
+ PHPVariable var = (PHPVariable) variables.get(i);
+ var.setParent(this);
+ // adjust name if value type is array
+ // (still bare name. make "['name']")
+ if (fValue.getReferenceType() == PHPValue.PEVT_ARRAY) {
+ var.setName(var.getName());
+ }
+ }
+ }
DebugPlugin.getDefault().fireDebugEventSet(
new DebugEvent[] { new DebugEvent(this, DebugEvent.CHANGE,
* @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
*/
public boolean supportsValueModification() {
- return true;
+ return fModifiable;
+ }
+
+ /**
+ * Set whether this variable can be modified (default is true)
+ *
+ * for Global Variables root element only
+ */
+ public void setModifiable(boolean modifiable) {
+ fModifiable = modifiable;
}
/**
* with a type specific explanation.
*/
public String toString() {
- int type = -1;
String str = "";
switch (getReferenceType()) {
return str;
}
+
+ /*
+ * ONLY FOR net.sourceforge.phpdt.internal.debug.core.model.PHPDBGEvalString#copyItems(PHPVariable, PHPValue)
+ */
+ protected Object clone() throws CloneNotSupportedException {
+ PHPVariable var = new PHPVariable();
+ var.fValue = fValue;
+ var.fName = fName;
+ var.fStackFrame = fStackFrame;
+ var.fParent = fParent;
+ var.fLongName = fLongName;
+ var.fModifiable = fModifiable;
+ return var;
+ }
+
}