* Window - Preferences - Java - Code Style - Code Templates
*/
public abstract class XDebugAbstractValue extends XDebugElement implements IValue {
-
- public static final int VALUETYPE_UNKNOWN = -1;
- public static final int VALUETYPE_UNINITIALIZED = 0;
- public static final int VALUETYPE_STRING = 1;
- public static final int VALUETYPE_INT = 4;
- public static final int VALUETYPE_FLOAT = 5;
- public static final int VALUETYPE_BOOLEAN = 6;
- 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;
private IVariable[] fVariables;
protected String fValueString;
- protected int fType;
protected String fTypeName;
-
private boolean fhasChanged;
- public XDebugAbstractValue(XDebugVariable variable, Node varNode, String typeName) {
- super((XDebugTarget) variable.getDebugTarget());
- fVariable = variable;
- if (varNode==null){
- try {
- System.out.println(variable.getName()+"=null");
- } catch (DebugException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return;
- }
- setType(typeName);
+ public XDebugAbstractValue(XDebugStackFrame frame, Node varNode) {
+ super((XDebugTarget) frame.getDebugTarget());
+
+ fTypeName = PHPDebugUtils.getAttributeValue(varNode,"type");
+
+ int NumChildren = 0;
+ if (!PHPDebugUtils.getAttributeValue(varNode,"numchildren").equals("")) {
+ NumChildren = Integer.parseInt(PHPDebugUtils.getAttributeValue(varNode, "numchildren"));
+ }
+
NodeList property = varNode.getChildNodes();
- if (variable.hasChildren()) {
+ if (NumChildren > 0) {
renderValueString(""+property.getLength());
fVariables = new IVariable[property.getLength()];
for (int i = 0; i<property.getLength(); i++) {
Node propertyNode = property.item(i);
- fVariables[i] = new XDebugVariable(variable.getStackFrame(), propertyNode);
+ fVariables[i] = new XDebugVariable(frame, propertyNode);
}
}else {
-// fDataString="";
fVariables = new IVariable[0];
-// if (variable.getType()== XDebugVariable.VARTYPE_UNINITIALIZED)
-// fValueString="uninitialized";
-// else {
String str="";
try {
str=varNode.getFirstChild().getNodeValue();
} catch (NullPointerException e) {
str="";
}
- if (variable.getEncoding().equals("base64")) {
+
+
+ String Encoding = PHPDebugUtils.getAttributeValue(varNode,"encoding");
+
+ if (Encoding.equals("base64")) {
if (str.length()!=0)
str=new String(Base64.decode(str));
else
str="";
}
renderValueString(str);
-// }
}
String className=PHPDebugUtils.getAttributeValue(varNode,"classname");
if(!"".equals(className))
renderValueString(className);
-
}
public boolean hasChanged() {
return (fVariables.length > 0);
}
- public abstract void setType(String typeName);
public abstract void renderValueString(String data);
public abstract boolean verifyValue(String expression);
if( getDebugTarget() == null ) {
renderValueString(expression);
} else {
- if(((XDebugTarget) getDebugTarget()).setVarValue(fVariable.getFullName(),expression)) {
+ /* if(((XDebugTarget) getDebugTarget()).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;
}
import org.w3c.dom.Node;
public class XDebugArrayValue extends XDebugAbstractValue {
-
- public XDebugArrayValue(XDebugVariable variable, Node varNode,
- String typeName) {
- super(variable, varNode, typeName);
- }
-
- public void setType(String typeName) {
- fType = XDebugAbstractValue.VALUETYPE_ARRAY;
- fTypeName = typeName;
-
+ public XDebugArrayValue(XDebugStackFrame variable, Node value) {
+ super(variable, value);
}
public void renderValueString(String data) {
public boolean verifyValue(String expression) {
return false;
}
-}
+}
\ No newline at end of file
import org.w3c.dom.Node;
public class XDebugBooleanValue extends XDebugAbstractValue {
-
- public XDebugBooleanValue(XDebugVariable variable, Node varNode,
- String typeName) {
- super(variable, varNode, typeName);
+ public XDebugBooleanValue(XDebugStackFrame variable, Node value) {
+ super(variable, value);
}
public boolean supportsValueModification() {
return true;
}
- public void setType(String typeName) {
- fType=XDebugAbstractValue.VALUETYPE_BOOLEAN;
- fTypeName=typeName; }
-
public void renderValueString(String data) {
int value=-1;
try {
/**
- *
+ * @author Christian
+ *
*/
-package net.sourceforge.phpeclipse.xdebug.php.model;
-
+package net.sourceforge.phpeclipse.xdebug.php.model;
import net.sourceforge.phpeclipse.xdebug.php.launching.IXDebugConstants;
-
-//import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.PlatformObject;
-//import org.eclipse.debug.core.DebugEvent;
-//import org.eclipse.debug.core.DebugException;
-//import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
-//import org.eclipse.debug.core.model.IVariable;
-/**
- * @author Christian
- *
- */
public class XDebugElement extends PlatformObject implements IDebugElement {
-
// containing target
private XDebugTarget fTarget;
return super.getAdapter(adapter);
}
- //protected void abort(String message, Throwable e) throws DebugException {
-/* Axel auskommentiert
- throw new DebugException(new Status(IStatus.ERROR, DebugExamplesPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
- DebugPlugin.INTERNAL_ERROR, message, e));
-*/
- //}
-
/**
* Fires a debug event
*
* @param event the event to be fired
*/
-// protected void fireEvent(DebugEvent event) {
-// DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
-// }
-
- /**
- * Fires a <code>CREATE</code> event for this element.
- */
-// public void fireCreationEvent() {
-// fireEvent(new DebugEvent(this, DebugEvent.CREATE));
-// }
-
- /**
- * Fires a <code>RESUME</code> event for this element with
- * the given detail.
- *
- * @param detail event detail code
- */
-// public void fireResumeEvent(int detail) {
-// fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail));
-// }
-
- /**
- * Fires a <code>SUSPEND</code> event for this element with
- * the given detail.
- *
- * @param detail event detail code
- */
-// public void fireSuspendEvent(int detail) {
-// fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail));
-// }
-
- /**
- * Fires a <code>TERMINATE</code> event for this element.
- */
-// protected void fireTerminateEvent() {
-// fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
-// }
+ protected void fireEvent(DebugEvent event) {
+ DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] {event});
+ }
}
\ No newline at end of file
import org.w3c.dom.Node;
public class XDebugFloatValue extends XDebugAbstractValue {
- public XDebugFloatValue(XDebugVariable variable, Node varNode,String TypeName) {
- super(variable, varNode,TypeName);
+ public XDebugFloatValue(XDebugStackFrame variable, Node value) {
+ super(variable, value);
}
public boolean supportsValueModification() {
return true;
}
-
- public void setType(String typeName) {
- fType = XDebugAbstractValue.VALUETYPE_FLOAT;
- fTypeName = typeName;
- }
public void renderValueString(String data) {
fValueString = data;
import org.w3c.dom.Node;
public class XDebugIntValue extends XDebugAbstractValue {
- public XDebugIntValue(XDebugVariable variable, Node varNode,String TypeName) {
- super(variable, varNode,TypeName);
- }
-
- public void setType(String typeName) {
- fType = XDebugAbstractValue.VALUETYPE_INT;
- fTypeName = typeName;
+ public XDebugIntValue(XDebugStackFrame frame, Node value) {
+ super(frame, value);
}
public boolean supportsValueModification() {
import org.w3c.dom.Node;
public class XDebugObjectValue extends XDebugAbstractValue {
- public XDebugObjectValue(XDebugVariable variable, Node varNode,
- String typeName) {
- super(variable, varNode, typeName);
- }
-
- public void setType(String typeName) {
- fType = XDebugAbstractValue.VALUETYPE_OBJECT;
- fTypeName = typeName;
-
+ public XDebugObjectValue(XDebugStackFrame variable, Node value) {
+ super(variable, value);
}
public void renderValueString(String data) {
fValueString = data;
-
}
public boolean verifyValue(String expression) {
import org.w3c.dom.Node;
public class XDebugResourceValue extends XDebugAbstractValue {
- public XDebugResourceValue(XDebugVariable variable, Node varNode,
- String typeName) {
- super(variable, varNode, typeName);
- }
-
- public void setType(String typeName) {
- fType = XDebugAbstractValue.VALUETYPE_RESOURCE;
- fTypeName = typeName;
+ public XDebugResourceValue(XDebugStackFrame variable, Node value) {
+ super(variable, value);
}
public void renderValueString(String data) {
import org.w3c.dom.Node;
public class XDebugStringValue extends XDebugAbstractValue {
- public XDebugStringValue(XDebugVariable variable, Node varNode,
- String typeName) {
- super(variable, varNode, typeName);
- }
-
- public void setType(String typeName) {
- fType = XDebugAbstractValue.VALUETYPE_STRING;
- fTypeName = typeName;
+ public XDebugStringValue(XDebugStackFrame variable, Node value) {
+ super(variable, value);
}
public void renderValueString(String data) {
public boolean verifyValue(String expression) {
return true;
}
-}
+}
\ No newline at end of file
import org.w3c.dom.Node;
public class XDebugValue extends XDebugAbstractValue {
- public XDebugValue(XDebugVariable variable, Node varNode, String typeName) {
- super(variable, varNode, typeName);
+ public XDebugValue(XDebugStackFrame variable, Node value) {
+ super(variable, value);
fValueString = "uninitialized";
- fType = XDebugAbstractValue.VALUETYPE_UNINITIALIZED;
fTypeName = "unknown";
}
- public void setType(String typeName) {
- }
-
public void renderValueString(String data) {
}
public boolean verifyValue(String expression) {
return false;
}
-}
+}
\ No newline at end of file
import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
-//import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException;
-//import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.model.IValue;
import org.eclipse.debug.core.model.IVariable;
import org.w3c.dom.Node;
-//import org.eclipse.debug.core.model.IWatchExpressionDelegate;
+
/**
* @author Axel
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
-public class XDebugVariable extends XDebugElement implements IVariable/*, IWatchExpressionFactoryAdapter*/ {
- /*public static final int VARTYPE_UNKNOWN = -1;
- public static final int VARTYPE_UNINITIALIZED = 0;
- public static final int VARTYPE_STRING = 1;
- public static final int VARTYPE_INT = 2;
- public static final int VARTYPE_FLOAT = 3;
- public static final int VARTYPE_ARRAY = 8;
- public static final int VARTYPE_HASH = 9;
- public static final int VARTYPE_OBJECT = 10;
- public static final int VARTYPE_RESOURCE = 11;*/
-
- private int fNumChildren;
+public class XDebugVariable extends XDebugElement implements IVariable {
private String fName;
private String fFullName;
- private String fEncoding;
private XDebugStackFrame fFrame;
private XDebugAbstractValue fValue;
private String fFacet;
fName = PHPDebugUtils.getAttributeValue(property,"name");
if ("".equals(fName)) {
fName = address;
- } /*else {
- varName = Name;
- }*/
+ }
fFullName = PHPDebugUtils.getAttributeValue(property,"fullname");
- fEncoding = PHPDebugUtils.getAttributeValue(property,"encoding");
- if (PHPDebugUtils.getAttributeValue(property,"numchildren").equals("")) {
- fNumChildren = 0;
- } else {
- fNumChildren = Integer.parseInt(PHPDebugUtils.getAttributeValue(property, "numchildren"));
- }
String typeName = PHPDebugUtils.getAttributeValue(property, "type");
fFacet = PHPDebugUtils.getAttributeValue(property, "facet");
if (typeName.equals("int") )
- fValue= new XDebugIntValue(this,property,typeName);
+ fValue = new XDebugIntValue(frame, property);
else if (typeName.equals("float") )
- fValue= new XDebugFloatValue(this,property,typeName);
+ fValue = new XDebugFloatValue(frame, property);
else if (typeName.equals("bool") )
- fValue= new XDebugBooleanValue(this,property,typeName);
+ fValue = new XDebugBooleanValue(frame, property);
else if (typeName.equals("string") )
- fValue= new XDebugStringValue(this,property,typeName);
+ fValue = new XDebugStringValue(frame, property);
else if (typeName.equals("array") )
- fValue= new XDebugArrayValue(this,property,typeName);
+ fValue = new XDebugArrayValue(frame, property);
else if (typeName.equals("hash") )
- fValue= new XDebugArrayValue(this,property,typeName);
+ fValue = new XDebugArrayValue(frame, property);
else if (typeName.equals("object") )
- fValue= new XDebugArrayValue(this,property,typeName);
+ fValue = new XDebugArrayValue(frame, property);
else if (typeName.equals("resource") )
- fValue= new XDebugResourceValue(this, property, typeName);
+ fValue = new XDebugResourceValue(frame, property);
else
- fValue= new XDebugValue(this,property,typeName);
+ fValue = new XDebugValue(frame, property);
}
/* (non-Javadoc)
*/
public IValue getValue() throws DebugException {
return fValue;
-// return ((XDebugTarget)getDebugTarget()).getVariableValue(this);
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IValueModification#setValue(org.eclipse.debug.core.model.IValue)
*/
public void setValue(IValue value) throws DebugException {
- fValue.setValueB(value);
+ //fValue.setValueB(value);
}
/* (non-Javadoc)
return fFrame;
}
-// public int getType() {
-// return fType;
-// }
-
public String getValueString() throws DebugException {
return fValue.getValueString();
}
- /*public setValueString(String newValueStrig) throws DebugException {
- fValue.setValueString getValueString();
- }*/
-
- public boolean hasChildren() {
- return (fNumChildren > 0);
- }
-
- public String getEncoding() {
- return fEncoding;
- }
-
public String getVisibility() {
return fFacet;
}
- public void setEncoding(String encoding) {
- fEncoding = encoding;
- }
-
public String toString() {
return null;
}
public String getFullName() {
return fFullName;
}
-
- public int getNumChildren() {
- return fNumChildren;
- }
-
- public void setChange(IVariable oldVariable) throws DebugException {
- XDebugAbstractValue oldValue = null;
- IVariable[] newVariable = null;
- IVariable[] oldVariable1 = null;
-
- try {
- oldValue = (XDebugAbstractValue) oldVariable.getValue();
- } catch (DebugException e) {
- }
-
- try {
- oldVariable1 = ((XDebugVariable)oldVariable).getValue().getVariables();
- newVariable = fValue.getVariables();
- } catch (DebugException e) {
- }
-
-
- if(((XDebugVariable) oldVariable).getNumChildren() > 0) {
- if ( this.getNumChildren() == 0) {
- try {
- if (!fValue.getValueString().equals(((XDebugAbstractValue)oldValue).getValueString())) {
- fValue.sethasChanged(true);
- } else {
- fValue.sethasChanged(false);
- }
- } catch (DebugException e) {
- }
- } else {
- for(int i = 0; i < newVariable.length; i++) {
- ((XDebugVariable)newVariable[i]).setChange(((XDebugVariable)oldVariable1[i]));
- }
- }
- } else {
- if ( this.getNumChildren() == 0) {
- // controllare anche il tipo (unknow)
- //if (!fValue.getValueString().equals("uninitialized")) {
- if (!fValue.getValueString().equals(oldValue.getValueString())) {
- fValue.sethasChanged(true);
- } else {
- fValue.sethasChanged(false);
- }
- } else {
- //IVariable dummy = new XDebugVariable("UNKNOWN", "");
- /*dummy.setValue("uninitialized");
- for(int i = 0; i < newVariable.length; i++) {
- ((XDebugVariable)newVariable[i]).setChange(dummy);
- }
- fValue.sethasChanged(true);*/
- }
- }
- }
- /**
- * Creates and returns an expression for the specified variable
- * which is used to created an {@link org.eclipse.debug.core.model.IWatchExpression}.
- *
- * @param variable variable a watch expression is required for
- * @return text used to create a watch expression
- * @exception org.eclipse.core.runtime.CoreException if unable to create a watch
- * expression
- */
- /*public String createWatchExpression(IVariable variable) throws CoreException {
-
- }*/
}
\ No newline at end of file