handleEvent(Event event)
{
new AEThread2("GenerateNetDiag", true)
{
public void run() {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter( sw );
IndentWriter iw = new IndentWriter( pw );
NetworkAdmin admin = NetworkAdmin.getSingleton();
admin.generateDiagnostics( iw );
pw.close();
final String info = sw.toString();
Logger.log( new LogEvent(LOGID, "Network Info:\n" + info));
Utils.execSWTThread(
new Runnable()
{
public void
run()
{
ClipboardCopy.copyToClipBoard( info );
}
});
}
}.start();
}
});
// stats
Label generate_stats_info = new Label(gLogging, SWT.NULL);
Messages.setLanguageText(generate_stats_info, CFG_PREFIX + "statsinfo");
Button generate_stats_button = new Button(gLogging, SWT.PUSH);
Messages.setLanguageText(generate_stats_button, CFG_PREFIX + "generatediagnostics");
generate_stats_button.addListener(
SWT.Selection,
new Listener()
{
public void
handleEvent(Event event)
{
java.util.Set types = new HashSet();
types.add( AzureusCoreStats.ST_ALL );
Map reply = AzureusCoreStats.getStats( types );
Iterator it = reply.entrySet().iterator();
StringBuffer buffer = new StringBuffer(16000);
while( it.hasNext()){
Map.Entry entry = (Map.Entry)it.next();
buffer.append( entry.getKey() + " -> " + entry.getValue() + "\r\n" );
}
String str = buffer.toString();
ClipboardCopy.copyToClipBoard( str );
Logger.log( new LogEvent(LOGID, "Stats Info:\n" + str));
}
});
// diagnostics
Label generate_info = new Label(gLogging, SWT.NULL);
Messages.setLanguageText(generate_info, CFG_PREFIX + "generatediagnostics.info");
Button generate_button = new Button(gLogging, SWT.PUSH);
Messages.setLanguageText(generate_button, CFG_PREFIX + "generatediagnostics");
generate_button.addListener(
SWT.Selection,
new Listener()
{
public void
handleEvent(Event event)
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter( sw );
AEDiagnostics.generateEvidence( pw );
pw.close();
String evidence = sw.toString();
ClipboardCopy.copyToClipBoard( evidence );
Logger.log( new LogEvent(LOGID, "Evidence Generation:\n" + evidence));
}