Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvpunski2010-02-16 10:18:32 +0000
committervpunski2010-02-16 10:18:32 +0000
commite8c64d8c0effdaaba981d884084e6e5d24e3269a (patch)
treedb898c65651f779f86e2c1499c8f0271a57e0e6a
parent430d8a60cf2ed132b152743de7c6ac4f22aad4f1 (diff)
downloadorg.eclipse.pdt-e8c64d8c0effdaaba981d884084e6e5d24e3269a.tar.gz
org.eclipse.pdt-e8c64d8c0effdaaba981d884084e6e5d24e3269a.tar.xz
org.eclipse.pdt-e8c64d8c0effdaaba981d884084e6e5d24e3269a.zip
0028163: [Ticket 187235] [Roman] Variables view incorrectly displays Namespace\Class
-rw-r--r--plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java122
1 files changed, 68 insertions, 54 deletions
diff --git a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java
index 6099aa46b..d34b37693 100644
--- a/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java
+++ b/plugins/org.eclipse.php.debug.core/src/org/eclipse/php/internal/debug/core/zend/debugger/ExpressionsValueDeserializer.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2006 Zend Corporation and IBM Corporation.
+ * Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
- * Zend and IBM - Initial implementation
+ * IBM Corporation - initial API and implementation
+ * Zend Technologies
*******************************************************************************/
package org.eclipse.php.internal.debug.core.zend.debugger;
@@ -16,7 +17,7 @@ import java.io.UnsupportedEncodingException;
public class ExpressionsValueDeserializer {
private String fEncoding;
-
+
public ExpressionsValueDeserializer(String encoding) {
fEncoding = encoding;
}
@@ -24,45 +25,45 @@ public class ExpressionsValueDeserializer {
public ExpressionValue deserializer(Expression expression, byte[] value) {
if (value == null) {
// the expression is Illeagal.
- value = new byte[] {'N'};
+ value = new byte[] { 'N' };
}
return build(expression, new VariableReader(value));
}
-
-// private byte[] getBytes(String text) {
-// try {
-// return text.getBytes(fEncoding);
-// } catch (UnsupportedEncodingException e) {
-// }
-// return text.getBytes();
-// }
-
- private String getText(byte[] buf) {
- try {
- return new String(buf, fEncoding);
- } catch (UnsupportedEncodingException e) {
- }
- return new String(buf);
- }
+
+ // private byte[] getBytes(String text) {
+ // try {
+ // return text.getBytes(fEncoding);
+ // } catch (UnsupportedEncodingException e) {
+ // }
+ // return text.getBytes();
+ // }
+
+ private String getText(byte[] buf) {
+ try {
+ return new String(buf, fEncoding);
+ } catch (UnsupportedEncodingException e) {
+ }
+ return new String(buf);
+ }
private ExpressionValue build(Expression expression, VariableReader reader) {
char type = reader.readType();
switch (type) {
- case 'i':
- return buildIntType(reader);
- case 'd':
- return buildDoubleType(reader);
- case 's':
- return buildSringType(reader);
- case 'b':
- return buildBooleanType(reader);
- case 'r':
- return buildResourceType(reader);
- case 'a':
- return buildArrayType(expression, reader);
- case 'O':
- return buildObjectType(expression, reader);
+ case 'i':
+ return buildIntType(reader);
+ case 'd':
+ return buildDoubleType(reader);
+ case 's':
+ return buildSringType(reader);
+ case 'b':
+ return buildBooleanType(reader);
+ case 'r':
+ return buildResourceType(reader);
+ case 'a':
+ return buildArrayType(expression, reader);
+ case 'O':
+ return buildObjectType(expression, reader);
}
return ExpressionValue.NULL_VALUE;
}
@@ -70,25 +71,30 @@ public class ExpressionsValueDeserializer {
private ExpressionValue buildIntType(VariableReader reader) {
String value = reader.readToken();
String valueAsString = "(int) " + value;
- return new ExpressionValue(ExpressionValue.INT_TYPE, value, valueAsString, null);
+ return new ExpressionValue(ExpressionValue.INT_TYPE, value,
+ valueAsString, null);
}
private ExpressionValue buildDoubleType(VariableReader reader) {
String value = reader.readToken();
String valueAsString = "(double) " + value;
- return new ExpressionValue(ExpressionValue.DOUBLE_TYPE, value, valueAsString, null);
+ return new ExpressionValue(ExpressionValue.DOUBLE_TYPE, value,
+ valueAsString, null);
}
private ExpressionValue buildSringType(VariableReader reader) {
String value = reader.readString();
- String valueAsString = "(string:" + value.length() + ") " + value.replaceAll("\\\\", "\\\\\\\\");
- return new ExpressionValue(ExpressionValue.STRING_TYPE, value, valueAsString, null);
+ String valueAsString = "(string:" + value.length() + ") " + value;
+ return new ExpressionValue(ExpressionValue.STRING_TYPE, value,
+ valueAsString, null);
}
private ExpressionValue buildBooleanType(VariableReader reader) {
String value = reader.readToken();
- String valueAsString = "(boolean) " + ((value.equals("0")) ? "false" : "true");
- return new ExpressionValue(ExpressionValue.BOOLEAN_TYPE, value, valueAsString, null);
+ String valueAsString = "(boolean) "
+ + ((value.equals("0")) ? "false" : "true");
+ return new ExpressionValue(ExpressionValue.BOOLEAN_TYPE, value,
+ valueAsString, null);
}
private ExpressionValue buildResourceType(VariableReader reader) {
@@ -96,15 +102,18 @@ public class ExpressionsValueDeserializer {
reader.readInt();
String value = reader.readToken();
- String valueAsString = "resource (" + resourceNumber + ") of type (" + value + ')';
- return new ExpressionValue(ExpressionValue.RESOURCE_TYPE, value, valueAsString, null);
+ String valueAsString = "resource (" + resourceNumber + ") of type ("
+ + value + ')';
+ return new ExpressionValue(ExpressionValue.RESOURCE_TYPE, value,
+ valueAsString, null);
}
- private ExpressionValue buildArrayType(Expression expression, VariableReader reader) {
+ private ExpressionValue buildArrayType(Expression expression,
+ VariableReader reader) {
int objectLength = reader.readInt();
int originalLength = objectLength;
- //System.out.println("objectLength " + objectLength);
+ // System.out.println("objectLength " + objectLength);
if (reader.isLastEnd()) {
objectLength = 0;
}
@@ -112,7 +121,7 @@ public class ExpressionsValueDeserializer {
for (int i = 0; i < objectLength; i++) {
char type = reader.readType();
- //System.out.println("type " + type);
+ // System.out.println("type " + type);
String name;
if (type == 'i') {
name = Integer.toString(reader.readInt());
@@ -122,15 +131,18 @@ public class ExpressionsValueDeserializer {
if (expression == null) {
variableNodes[i] = createDefaultVariable(name);
} else {
- variableNodes[i] = expression.createChildExpression(name, '[' + name + ']');
+ variableNodes[i] = expression.createChildExpression(name,
+ '[' + name + ']');
}
variableNodes[i].setValue(build(expression, reader));
}
- return new ExpressionValue(ExpressionValue.ARRAY_TYPE, "Array", "Array [" + originalLength + ']', variableNodes);
+ return new ExpressionValue(ExpressionValue.ARRAY_TYPE, "Array",
+ "Array [" + originalLength + ']', variableNodes);
}
- private ExpressionValue buildObjectType(Expression expression, VariableReader reader) {
+ private ExpressionValue buildObjectType(Expression expression,
+ VariableReader reader) {
String objectName = reader.readString();
int objectLength = reader.readInt();
@@ -142,7 +154,7 @@ public class ExpressionsValueDeserializer {
for (int i = 0; i < objectLength; i++) {
char type = reader.readType();
- //System.out.println("type " + type);
+ // System.out.println("type " + type);
String name;
if (type == 'i') {
name = Integer.toString(reader.readInt());
@@ -153,22 +165,24 @@ public class ExpressionsValueDeserializer {
if (expression == null) {
expressionNodes[i] = createDefaultVariable(name);
} else {
- expressionNodes[i] = expression.createChildExpression(name, "->" + name);
+ expressionNodes[i] = expression.createChildExpression(name,
+ "->" + name);
}
expressionNodes[i].setValue(build(expression, reader));
}
String valueAsString = "Object of: " + objectName;
- return new ExpressionValue(ExpressionValue.OBJECT_TYPE, objectName, valueAsString, expressionNodes);
+ return new ExpressionValue(ExpressionValue.OBJECT_TYPE, objectName,
+ valueAsString, expressionNodes);
}
private Expression createDefaultVariable(String name) {
return new DefaultExpression('$' + name);
}
- //////////////////////////////////////////////////////////////////////////////////////////////////
+ // ////////////////////////////////////////////////////////////////////////////////////////////////
// variable reader.
- //////////////////////////////////////////////////////////////////////////////////////////////////
+ // ////////////////////////////////////////////////////////////////////////////////////////////////
private class VariableReader extends ByteArrayInputStream {
private VariableReader(byte[] result) {

Back to the top