use of flash.tools.debugger.Variable 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.Variable in project intellij-plugins by JetBrains.
the class DebugCLI method appendFrameInfo.
/**
* Spit out frame information for a given frame number
*/
boolean appendFrameInfo(StringBuffer sb, Frame ctx, int frameNumber, boolean showThis, boolean showFileId) throws PlayerDebugException {
boolean validFrame = true;
// some formatting properties
int i = frameNumber;
Location loc = ctx.getLocation();
SourceFile file = loc.getFile();
int line = loc.getLine();
//$NON-NLS-1$
String name = (file == null) ? "<null>" : file.getName();
String sig = ctx.getCallSignature();
String func = extractFunctionName(sig);
// file == null or line < 0 appears to be a terminator for stack info
if (file == null && line < 0) {
validFrame = false;
} else {
Variable[] var = ctx.getArguments(m_session);
Variable dis = ctx.getThis(m_session);
boolean displayArgs = (func != null) || (var != null);
sb.append('#');
FieldFormat.formatLong(sb, i, 3);
sb.append(' ');
if (showThis && dis != null) {
ExpressionCache.appendVariable(sb, dis);
//$NON-NLS-1$
sb.append(".");
}
if (func != null)
sb.append(func);
if (displayArgs) {
sb.append('(');
for (int j = 0; j < var.length; j++) {
Variable v = var[j];
sb.append(v.getName());
sb.append('=');
ExpressionCache.appendVariableValue(sb, v.getValue());
if ((j + 1) < var.length)
//$NON-NLS-1$
sb.append(", ");
}
//$NON-NLS-1$
sb.append(")");
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("atFilename"));
}
sb.append(name);
// if this file is currently being filtered put the source file id after it
if (file != null && (showFileId || !m_fileInfo.inFileList(file))) {
sb.append('#');
sb.append(file.getId());
}
sb.append(':');
sb.append(line);
}
return validFrame;
}
use of flash.tools.debugger.Variable in project intellij-plugins by JetBrains.
the class DebugCLI method treeResults.
StringBuilder treeResults(StringBuilder sb, List<Object> e, String memName, boolean fullName) {
// walk the list
Iterator<Object> i = e.iterator();
while (i.hasNext()) {
String name = (String) i.next();
Variable key = (Variable) i.next();
Variable val = (Variable) i.next();
// sb.append(val.getName());
if (fullName)
sb.append(name);
ExpressionCache.appendVariableValue(sb, key.getValue(), key.getName());
//$NON-NLS-1$
sb.append(".");
sb.append(memName);
//$NON-NLS-1$
sb.append(" = ");
ExpressionCache.appendVariableValue(sb, val.getValue(), val.getName());
sb.append(m_newline);
}
return sb;
}
use of flash.tools.debugger.Variable in project intellij-plugins by JetBrains.
the class DebugCLI method doWhat.
/**
* Print the context of a Variable
*/
void doWhat() throws NotConnectedException {
/* wait a bit if we are not halted */
waitTilHalted();
try {
Object result = null;
/* 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;
/* dump the output */
StringBuilder sb = new StringBuilder();
if (result instanceof Variable) {
Variable v = (Variable) result;
// if it has a path then display it!
if (v.isAttributeSet(VariableAttribute.IS_LOCAL))
//$NON-NLS-1$
s = getLocalizationManager().getLocalizedTextString("localVariable");
else if (v.isAttributeSet(VariableAttribute.IS_ARGUMENT))
//$NON-NLS-1$
s = getLocalizationManager().getLocalizedTextString("functionArgumentVariable");
else if ((v instanceof VariableFacade) && (s = ((VariableFacade) v).getPath()) != null && s.length() > 0)
;
else
//$NON-NLS-1$
s = "_global";
sb.append(s);
} else
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("mustBeOnlyOneVariable"));
out(sb.toString());
} catch (IllegalAccessException iae) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noSideEffectsAllowed"));
} catch (NullPointerException npe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("couldNotEvaluate"));
}
}
use of flash.tools.debugger.Variable 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"));
}
}
Aggregations