public static final int VALUETYPE_ARRAY = 8;
public static final int VALUETYPE_HASH = 9;
public static final int VALUETYPE_OBJECT = 10;
+ public static final int VALUETYPE_RESOURCE = 11;
protected XDebugVariable fVariable;
protected int fType;
protected String fTypeName;
+ private boolean fhasChanged;
+
+ public XDebugAbstractValue(XDebugVariable variable, String typeName) {
+ super((XDebugTarget) variable.getDebugTarget());
+ fVariable = variable;
+ setType(typeName);
+ fVariables= new IVariable[0];
+ }
+
+
public XDebugAbstractValue(XDebugVariable variable,Node varNode,String typeName) {
super((XDebugTarget) variable.getDebugTarget());
fVariable = variable;
// }
}
String className=PHPDebugUtils.getAttributeValue(varNode,"classname");
- if(className!="")
+ if(!"".equals(className))
renderValueString(className);
}
+ public boolean hasChanged() {
+ return fhasChanged;
+ }
+
+ public void sethasChanged(boolean hasChanged) {
+ fhasChanged = hasChanged;
+ }
+
+ public void setChildVariables(IVariable[] newChildVariables) {
+ fVariables = newChildVariables;
+ }
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getReferenceTypeName()
*/
public String getReferenceTypeName() throws DebugException {
return fTypeName;
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getValueString()
*/
public String getValueString() throws DebugException {
return fValueString;
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#isAllocated()
*/
public boolean isAllocated() throws DebugException {
return true;
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#getVariables()
*/
public IVariable[] getVariables() throws DebugException {
return fVariables;
}
+
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValue#hasVariables()
*/
public boolean hasVariables() throws DebugException {
- return (fVariables.length>0);
+ return (fVariables.length > 0);
}
public boolean isArray() {
public boolean setValue(String expression) {
if (!verifyValue(expression))
return false;
- if(fTarget.setVarValue(fVariable.getFullName(),expression)) {
- renderValueString(expression);
- return true;
- }
+ if( fTarget == null ) {
+ renderValueString(expression);
+ } else {
+ if(fTarget.setVarValue(fVariable.getFullName(),expression)) {
+ renderValueString(expression);
+ return true;
+ }
+ }
return false;
}
+
+ public boolean setValueA(String expression) {
+ if(! fValueString.toString().equals(expression)) {
+ fVariables= new IVariable[0];
+ fValueString = expression;
+ fhasChanged = true;
+ } else {
+ fhasChanged = false;
+ }
+
+ return true;
+ }
+
+ public boolean setValueB(IValue value) {
+ try {
+ fTypeName = value.getReferenceTypeName();
+ } catch (DebugException e) {
+ }
+
+ fhasChanged = false;
+
+ switch (((XDebugAbstractValue) value). getType()) {
+ case VALUETYPE_UNINITIALIZED:
+ case VALUETYPE_STRING:
+ case VALUETYPE_INT:
+ case VALUETYPE_FLOAT:
+ case VALUETYPE_BOOLEAN:
+ try {
+ if (! fValueString.equals(value.getValueString())) {
+ fValueString = value.getValueString();
+ fhasChanged = true;
+ }
+ } catch (DebugException e) {
+ int a = 10;
+ a++;
+ }
+ break;
+
+ case VALUETYPE_RESOURCE:
+ try {
+ if (! fValueString.equals(value.getValueString())) {
+ fValueString = value.getValueString();
+ fhasChanged = true;
+ }
+ } catch (DebugException e) {
+ int a = 10;
+ a++;
+ }
+ break;
+
+ case VALUETYPE_HASH:
+ int a = 20;
+ a = a +2;
+ break;
+
+ case VALUETYPE_OBJECT:
+ case VALUETYPE_ARRAY:
+ try {
+ IVariable[] newVariable = value.getVariables();
+
+ if (fVariables.length == 0) {
+ if (newVariable.length > 0) {
+ fValueString = value.getValueString();
+ fVariables = newVariable;
+ fhasChanged = true;
+ }
+ } else {
+ for(int i = 0; i < fVariables.length; i++) {
+ // da capire quando e perche'
+ try {
+ if (! ((XDebugVariable)fVariables[i]).equals(((XDebugVariable)newVariable[i]))) {
+ //fVariables[i].setValue(newVariable[i].getValue());
+ fhasChanged = true;
+ }
+ } catch (Exception e) {
+ int b = 1;
+ }
+ }
+ if (fhasChanged) {
+ fValueString = value.getValueString();
+ for(int i = 0; i < fVariables.length; i++) {
+ try {
+ fVariables[i].setValue(newVariable[i].getValue());
+ } catch (Exception e) {
+ int b = 1;
+ }
+ }
+ }
+ }
+ } catch (DebugException e) {
+ int b = 10;
+ b++;
+ }
+
+ break;
+ }
+
+ return true;
+ }
+
+ public boolean setValueBOld(IValue value) {
+ fhasChanged = false;
+
+ switch (((XDebugAbstractValue) value). getType()) {
+ case VALUETYPE_UNINITIALIZED:
+ case VALUETYPE_STRING:
+ case VALUETYPE_INT:
+ case VALUETYPE_FLOAT:
+ case VALUETYPE_BOOLEAN:
+ try {
+ if (! fValueString.equals(value.getValueString())) {
+ fValueString = value.getValueString();
+ fhasChanged = true;
+ }
+ } catch (DebugException e) {
+ }
+ break;
+
+ case VALUETYPE_HASH:
+ int a = 20;
+ a = a +2;
+ break;
+
+ case VALUETYPE_OBJECT:
+ case VALUETYPE_ARRAY:
+ try {
+ IVariable[] newVariable = value.getVariables();
+
+ if (fVariables.length == 0) {
+ if (newVariable.length > 0) {
+ fValueString = value.getValueString();
+ fVariables = newVariable;
+ fhasChanged = true;
+ }
+ } else {
+ for(int i = 0; i < fVariables.length; i++) {
+ if (! ((XDebugVariable)fVariables[i]).equals(((XDebugVariable)newVariable[i]))) {
+ //fVariables[i].setValue(newVariable[i].getValue());
+ fhasChanged = true;
+ }
+ }
+ if (fhasChanged) {
+ fValueString = value.getValueString();
+ for(int i = 0; i < fVariables.length; i++) {
+ fVariables[i].setValue(newVariable[i].getValue());
+ }
+ }
+ }
+ } catch (DebugException e) {
+ }
+
+ break;
+ }
+
+ return true;
+ }
+
+ public int getType() {
+ return fType;
+ }
public boolean supportsValueModification() {
return false;
}
-}
+}
\ No newline at end of file