@Override
public String getColumnText(Object obj, int i)
{
if(obj instanceof EStackFrameLocation)
{
EStackFrameLocation frameLocation=(EStackFrameLocation) obj;
if(i==0)
return frameLocation.getStackFrame().getDepth() + "" + "-" + frameLocation.getStackFrame().getId() + "-" + frameLocation.getId();
/*if(i==1)
{
String ret=frameLocation.getStackFrame().getMethod().getDeclaringType().getName();
if(ret.contains("."))
ret = ret.substring(ret.lastIndexOf(".")+1);
/////////
if(frameLocation.getStackFrame().getThisObject()!=null)
ret += "(" + frameLocation.getStackFrame().getThisObject().getUniqueId() + ")";
///////
return ret;
}
/*if(i==2)
{
if(frameLocation.getStackFrame().getThisObject()!=null)
return frameLocation.getStackFrame().getThisObject().getUniqueId() + "";
return "";
}*
if(i==2)
return frameLocation.getStackFrame().getMethod().getName();*/
if(i==1)
{
String classObject=frameLocation.getStackFrame().getMethod().getDeclaringType().getName();
if(classObject.contains("."))
classObject = classObject.substring(classObject.lastIndexOf(".")+1);
/////////
if(frameLocation.getStackFrame().getThisObject()!=null)
classObject += "(" + frameLocation.getStackFrame().getThisObject().getUniqueId() + ")";
///////
String methodName = frameLocation.getStackFrame().getMethod().getName();
return classObject + "." + methodName + "(<unknown>)";
}
if(i==2)
{
String source = frameLocation.getStackFrame().getSourceName();
if(source==null)
{
if(frameLocation.getLineNumber()==-1)
return "<unknown>";
source = "<unknown>";
}
return source + ":" + frameLocation.getLineNumber() + "";
}
return null;
}
if(obj instanceof EStackFrameLocatableEvent || obj instanceof Object[])
{
EStackFrameLocatableEvent evento=null;
if(obj instanceof EStackFrameLocatableEvent)
evento=(EStackFrameLocatableEvent) obj;
else
evento=(EStackFrameLocatableEvent) ((Object[])obj)[1];
if(i==0)
return evento.getThreadSequence() + "-" + evento.getStackFrameLocation().getStackFrame().getDepth() + "-" + evento.getStackFrameLocation().getStackFrame().getId() + "-" + evento.getStackFrameLocation().getId();
if(i==1)
{
if(evento instanceof EClassLoadEvent)
return ((EClassLoadEvent)evento).getClase().getName();
if(evento instanceof ENewObjectEvent)
{
String classObject=((ENewObjectEvent)evento).getStackFrameLocation().getStackFrame().getMethod().getDeclaringType().getName();
if(classObject.contains("."))
classObject = classObject.substring(classObject.lastIndexOf(".")+1);
/////////
if(((ENewObjectEvent)evento).getStackFrameLocation().getStackFrame().getThisObject()!=null)
classObject += "(" + ((ENewObjectEvent)evento).getStackFrameLocation().getStackFrame().getThisObject().getUniqueId() + ")";
else
System.out.println("null???" + obj);
///////
String methodName = ((ENewObjectEvent)evento).getStackFrameLocation().getStackFrame().getMethod().getName();
Set<EArgument> args = ((ENewObjectEvent)evento).getArguments();
String ret="";
for(EArgument arg : args)
ret+= ", " + arg.getParameter().getName() + ":" + Value2String.toString(arg.getValue());
return classObject + "." + methodName + "(" + (ret.length()>0 ? ret.substring(2) : "") + ")";
}
if(evento instanceof EMethodEntryEvent)
{
String classObject=((EMethodEntryEvent)evento).getStackFrameLocation().getStackFrame().getMethod().getDeclaringType().getName();
if(classObject.contains("."))
classObject = classObject.substring(classObject.lastIndexOf(".")+1);
/////////
if(((EMethodEntryEvent)evento).getStackFrameLocation().getStackFrame().getThisObject()!=null)
classObject += "(" + ((EMethodEntryEvent)evento).getStackFrameLocation().getStackFrame().getThisObject().getUniqueId() + ")";
///////
String methodName = ((EMethodEntryEvent)evento).getStackFrameLocation().getStackFrame().getMethod().getName();
Set<EArgument> args = ((EMethodEntryEvent)evento).getArguments();
String ret="";
for(EArgument arg : args)
ret+= ", " + arg.getParameter().getName() + " : " + Value2String.toString(arg.getValue());
return classObject + "." + methodName + "(" + (ret.length()>0 ? ret.substring(2) : "") + ")";
}
if(evento instanceof EMethodExitEvent)
{
String classObject=((EMethodExitEvent)evento).getStackFrameLocation().getStackFrame().getMethod().getDeclaringType().getName();
if(classObject.contains("."))
classObject = classObject.substring(classObject.lastIndexOf(".")+1);
/////////
if(((EMethodExitEvent)evento).getStackFrameLocation().getStackFrame().getThisObject()!=null)
classObject += "(" + ((EMethodExitEvent)evento).getStackFrameLocation().getStackFrame().getThisObject().getUniqueId() + ")";
///////
String methodName = ((EMethodExitEvent)evento).getStackFrameLocation().getStackFrame().getMethod().getName();
if(!methodName.equals("<init>"))
{
if(!((EMethodExitEvent)evento).getStackFrameLocation().getStackFrame().getMethod().isReturnVoid())
return classObject + "." + methodName + "() : " + Value2String.toString(((EMethodExitEvent)evento).getReturnValue());
return classObject + "." + methodName + "() : <void>";
}
return classObject + "." + methodName + "() : (" + ((EMethodExitEvent)evento).getStackFrameLocation().getStackFrame().getThisObject().getUniqueId() + ")";
}
if(evento instanceof EFieldAccessEvent)
{
String simpleName = ((EFieldAccessEvent)evento).getField().getDeclaringType().getName();
simpleName = simpleName.contains(".") ? simpleName.substring(simpleName.lastIndexOf(".")+1) : simpleName;
if(((EFieldAccessEvent)evento).getStackFrameLocation().getStackFrame().getThisObject()!=null)
simpleName += "(" + ((EFieldAccessEvent)evento).getStackFrameLocation().getStackFrame().getThisObject().getUniqueId() + ")";
return simpleName + "." + ((EFieldAccessEvent)evento).getField().getName() + " : "
+ Value2String.toString(((EFieldAccessEvent)evento).getValue());
}
if(evento instanceof EFieldModificationEvent)
{
String simpleName = ((EFieldModificationEvent)evento).getField().getDeclaringType().getName();
simpleName = simpleName.contains(".") ? simpleName.substring(simpleName.lastIndexOf(".")+1) : simpleName;
if(((EFieldModificationEvent)evento).getStackFrameLocation().getStackFrame().getThisObject()!=null)
simpleName += "(" + ((EFieldModificationEvent)evento).getStackFrameLocation().getStackFrame().getThisObject().getUniqueId() + ")";
return simpleName + "." + ((EFieldModificationEvent)evento).getField().getName() + " : "
+ Value2String.toString(((EFieldModificationEvent)evento).getValue()) + " -> "
+ Value2String.toString(((EFieldModificationEvent)evento).getValueToBe());
}
if(evento instanceof EExceptionEvent)
return ((EExceptionEvent)evento).getException().getReferenceType().getName();
if(evento instanceof EMonitorEnterEvent)
return Value2String.toString(((EMonitorEnterEvent)evento).getMonitor());
if(evento instanceof EMonitorEnteredEvent)
return Value2String.toString(((EMonitorEnteredEvent)evento).getMonitor());
if(evento instanceof EMonitorWaitEvent)
return Value2String.toString(((EMonitorWaitEvent)evento).getMonitor()) + " wait " + ((EMonitorWaitEvent)evento).getTimeOut() + " milis";
if(evento instanceof EMonitorWaitedEvent)
return Value2String.toString(((EMonitorWaitedEvent)evento).getMonitor()) + (((EMonitorWaitedEvent)evento).getTimedOut() ? "timedOut" : "");
return "???";
}
if(i==2)
{
EStackFrameLocation loc = evento.getStackFrameLocation();
if(obj instanceof Object[])
loc = (EStackFrameLocation) ((Object[])obj)[0];
String source = loc.getStackFrame().getSourceName();
if(source==null)
{
if(loc.getLineNumber()==-1)
return "<unknown>";
source = "<unknown>";
}
return source + ":" + loc.getLineNumber() + "";
}
}
return "???";
}