use of flash.tools.debugger.expression.NoSuchVariableException in project intellij-plugins by JetBrains.
the class DebugCLI method processDisplay.
// iterate through our display list entries
void processDisplay(StringBuffer sb) {
int count = displayCount();
for (int i = 0; i < count; i++) {
DisplayAction a = displayAt(i);
if (a.isEnabled()) {
try {
sb.append(a.getId());
//$NON-NLS-1$
sb.append(": ");
sb.append(a.getContent());
//$NON-NLS-1$
sb.append(" = ");
// command[0] contains our expression, so first we parse it, evalulate it then print it
Object result = m_exprCache.evaluate(a.getExpression());
if (result instanceof Variable)
ExpressionCache.appendVariableValue(sb, ((Variable) result).getValue());
else if (result instanceof Value)
ExpressionCache.appendVariableValue(sb, (Value) result);
else if (result instanceof InternalProperty)
sb.append(((InternalProperty) result).valueOf());
else
sb.append(result);
sb.append(m_newline);
} catch (NoSuchVariableException nsv) {
Map args = new HashMap();
//$NON-NLS-1$
args.put("variable", nsv.getMessage());
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("variableUnknown", args));
sb.append(m_newline);
} catch (NumberFormatException nfe) {
Map args = new HashMap();
//$NON-NLS-1$
args.put("value", nfe.getMessage());
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("couldNotConvertToNumber", args));
sb.append(m_newline);
} catch (PlayerFaultException pfe) {
sb.append(pfe.getMessage() + m_newline);
} catch (NullPointerException npe) {
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("couldNotEvaluate"));
}
}
}
}
use of flash.tools.debugger.expression.NoSuchVariableException in project intellij-plugins by JetBrains.
the class DebugCLI method doMcTree.
/**
* Specialized dump of the contents of a movie clip tree, dumping
* all the _target properties of all MCs
* @throws NoResponseException
* @throws NotSuspendedException
*/
void doMcTree() throws NotConnectedException, NotSuspendedException, NoResponseException {
/* wait a bit if we are not halted */
waitTilHalted();
try {
// our variable reference
String var = nextToken();
//$NON-NLS-1$
String member = "_target";
boolean printPath = false;
Object result = null;
String name = null;
// did the user specify a member name
if (hasMoreTokens()) {
member = nextToken();
// did they specify some other options
while (hasMoreTokens()) {
String option = nextToken();
if (//$NON-NLS-1$
option.equalsIgnoreCase("fullpath"))
printPath = true;
}
}
// first parse it, then attempt to evaluate the expression
ValueExp expr = parseExpression(var);
result = evalExpression(expr).value;
StringBuilder sb = new StringBuilder();
if (result instanceof Variable) {
name = ((Variable) result).getName();
result = ((Variable) result).getValue();
}
if (result instanceof Value) {
ArrayList<Object> e = new ArrayList<Object>();
dumpTree(new HashMap<Object, String>(), e, name, (Value) result, member);
// now sort according to our criteria
treeResults(sb, e, member, printPath);
} else
throw new NoSuchVariableException(result);
out(sb.toString());
} catch (NoSuchVariableException nsv) {
Map<String, Object> args = new HashMap<String, Object>();
//$NON-NLS-1$
args.put("variable", nsv.getMessage());
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("variableUnknown", args));
} catch (NullPointerException npe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("couldNotEvaluate"));
}
}
use of flash.tools.debugger.expression.NoSuchVariableException in project intellij-plugins by JetBrains.
the class DebugCLI method doPrint.
void doPrint() throws NotConnectedException {
// waitTilHalted();
try {
Object result = null;
boolean isLookupMembers = false;
if (!hasMoreTokens()) {
try {
// attempt to get the last result
//$NON-NLS-1$
result = m_exprCache.get("$");
} catch (ArrayIndexOutOfBoundsException aib) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("commandHistoryIsEmpty"));
throw new NullPointerException();
}
} else {
// pull the rest of the line
String s = restOfLine();
// first parse it, then attempt to evaluate the expression
ValueExp expr = parseExpression(s);
// make sure no assignment
if (expr.containsAssignment())
throw new IllegalAccessException();
result = evalExpression(expr).value;
isLookupMembers = expr.isLookupMembers();
}
/* it worked, add it to the list */
int which = m_exprCache.add(result);
/* dump the output */
StringBuilder sb = new StringBuilder();
sb.append('$');
sb.append(which);
//$NON-NLS-1$
sb.append(" = ");
if (result instanceof Variable)
result = ((Variable) result).getValue();
if (result instanceof InternalProperty)
sb.append(((InternalProperty) result).valueOf());
else if (isLookupMembers)
sb.append(result);
else
ExpressionCache.appendVariableValue(sb, result);
out(sb.toString());
m_repeatLine = m_currentLine;
} catch (ArrayIndexOutOfBoundsException aio) {
// $n not in range 0..size
Map<String, Object> args = new HashMap<String, Object>();
//$NON-NLS-1$
args.put("number", aio.getMessage());
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("historyHasNotReached", args));
} catch (IllegalAccessException iae) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noSideEffectsAllowed"));
} catch (NoSuchVariableException nsv) {
Map<String, Object> args = new HashMap<String, Object>();
//$NON-NLS-1$
args.put("variable", nsv.getMessage());
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("variableUnknown", args));
} catch (NullPointerException npe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("couldNotEvaluate"));
}
}
Aggregations