📄 configsectionlogging.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: ConfigSectionLogging.java
package org.gudy.azureus2.ui.swt.views.configsections;
import com.aelitis.azureus.core.networkmanager.admin.NetworkAdmin;
import com.aelitis.azureus.core.stats.AzureusCoreStats;
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.logging.*;
import org.gudy.azureus2.core3.logging.impl.FileLogging;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.config.*;
import org.gudy.azureus2.ui.swt.mainwindow.ClipboardCopy;
import org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection;
public class ConfigSectionLogging
implements UISWTConfigSection
{
private static final LogIDs LOGID;
private static final String CFG_PREFIX = "ConfigView.section.logging.";
private static final int logFileSizes[] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
15, 20, 25, 30, 40, 50, 75, 100, 200, 300,
500
};
public ConfigSectionLogging()
{
}
public String configSectionGetParentSection()
{
return "root";
}
public String configSectionGetName()
{
return "logging";
}
public void configSectionSave()
{
}
public void configSectionDelete()
{
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.releaseImage("openFolderButton");
}
public int maxUserMode()
{
return 2;
}
public Composite configSectionCreate(final Composite parent)
{
ImageLoader imageLoader = ImageLoader.getInstance();
Image imgOpenFolder = imageLoader.getImage("openFolderButton");
Composite gLogging = new Composite(parent, 0);
GridData gridData = new GridData(272);
gLogging.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
gLogging.setLayout(layout);
int userMode = COConfigurationManager.getIntParameter("User Mode");
BooleanParameter enable_logger = new BooleanParameter(gLogging, "Logger.Enabled", "ConfigView.section.logging.loggerenable");
gridData = new GridData();
gridData.horizontalSpan = 2;
enable_logger.setLayoutData(gridData);
final BooleanParameter enableLogging = new BooleanParameter(gLogging, "Logging Enable", "ConfigView.section.logging.enable");
gridData = new GridData();
gridData.horizontalSpan = 2;
enableLogging.setLayoutData(gridData);
Composite cArea = new Composite(gLogging, 0);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 3;
cArea.setLayout(layout);
gridData = new GridData(768);
gridData.horizontalSpan = 2;
cArea.setLayoutData(gridData);
Label lStatsPath = new Label(cArea, 0);
Messages.setLanguageText(lStatsPath, "ConfigView.section.logging.logdir");
gridData = new GridData();
gridData.widthHint = 150;
final StringParameter pathParameter = new StringParameter(cArea, "Logging Dir");
pathParameter.setLayoutData(gridData);
Button browse = new Button(cArea, 8);
browse.setImage(imgOpenFolder);
imgOpenFolder.setBackground(browse.getBackground());
browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
browse.addListener(13, new Listener() {
final Composite val$parent;
final StringParameter val$pathParameter;
final ConfigSectionLogging this$0;
public void handleEvent(Event event)
{
DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), 0x10000);
dialog.setFilterPath(pathParameter.getValue());
dialog.setText(MessageText.getString("ConfigView.section.logging.choosedefaultsavepath"));
String path = dialog.open();
if (path != null)
pathParameter.setValue(path);
}
{
this$0 = ConfigSectionLogging.this;
parent = composite;
pathParameter = stringparameter;
super();
}
});
Label lMaxLog = new Label(cArea, 0);
Messages.setLanguageText(lMaxLog, "ConfigView.section.logging.maxsize");
String lmLabels[] = new String[logFileSizes.length];
int lmValues[] = new int[logFileSizes.length];
for (int i = 0; i < logFileSizes.length; i++)
{
int num = logFileSizes[i];
lmLabels[i] = (new StringBuilder()).append(" ").append(num).append(" MB").toString();
lmValues[i] = num;
}
IntListParameter paramMaxSize = new IntListParameter(cArea, "Logging Max Size", lmLabels, lmValues);
gridData = new GridData();
gridData.horizontalSpan = 2;
paramMaxSize.setLayoutData(gridData);
if (userMode > 1)
{
Label timeStampLbl = new Label(cArea, 0);
Messages.setLanguageText(timeStampLbl, "ConfigView.section.logging.timestamp");
timeStampLbl.setLayoutData(new GridData());
StringParameter timeStamp = new StringParameter(cArea, "Logging Timestamp");
gridData = new GridData();
gridData.horizontalSpan = 2;
gridData.widthHint = 150;
timeStamp.setLayoutData(gridData);
}
String sFilterPrefix = "ConfigView.section.logging.filter";
Group gLogIDs = new Group(gLogging, 0);
Messages.setLanguageText(gLogIDs, "ConfigView.section.logging.filter");
layout = new GridLayout();
layout.numColumns = 2;
gLogIDs.setLayout(layout);
gridData = new GridData(1, 1, true, true);
gridData.horizontalSpan = 2;
gLogIDs.setLayoutData(gridData);
final List listLogTypes = new List(gLogIDs, 2564);
gridData = new GridData(0, 1, false, false);
listLogTypes.setLayoutData(gridData);
final int logTypes[] = {
0, 1, 3
};
for (int i = 0; i < logTypes.length; i++)
listLogTypes.add(MessageText.getString((new StringBuilder()).append("ConfigView.section.logging.log").append(i).append("type").toString()));
listLogTypes.select(0);
LogIDs logIDs[] = FileLogging.configurableLOGIDs;
final Table tableLogIDs = new Table(gLogIDs, 0x10824);
gridData = new GridData(1808);
tableLogIDs.setLayoutData(gridData);
tableLogIDs.setLinesVisible(false);
tableLogIDs.setHeaderVisible(false);
TableColumn column = new TableColumn(tableLogIDs, 0);
for (int i = 0; i < logIDs.length; i++)
{
TableItem item = new TableItem(tableLogIDs, 0);
item.setText(0, MessageText.getString((new StringBuilder()).append("ConfigView.section.logging.filter.").append(logIDs[i]).toString(), logIDs[i].toString()));
item.setData(logIDs[i]);
boolean checked = COConfigurationManager.getBooleanParameter((new StringBuilder()).append("bLog.").append(logTypes[0]).append(".").append(logIDs[i]).toString(), true);
item.setChecked(checked);
}
column.pack();
listLogTypes.addSelectionListener(new SelectionAdapter() {
final List val$listLogTypes;
final int val$logTypes[];
final Table val$tableLogIDs;
final ConfigSectionLogging this$0;
public void widgetSelected(SelectionEvent e)
{
int index = listLogTypes.getSelectionIndex();
if (index < 0 || index >= logTypes.length)
return;
TableItem items[] = tableLogIDs.getItems();
for (int i = 0; i < items.length; i++)
{
boolean checked = COConfigurationManager.getBooleanParameter((new StringBuilder()).append("bLog.").append(logTypes[index]).append(".").append(items[i].getData()).toString(), true);
items[i].setChecked(checked);
}
}
{
this$0 = ConfigSectionLogging.this;
listLogTypes = list;
logTypes = ai;
tableLogIDs = table;
super();
}
});
tableLogIDs.addSelectionListener(new SelectionAdapter() {
final List val$listLogTypes;
final int val$logTypes[];
final ConfigSectionLogging this$0;
public void widgetSelected(SelectionEvent e)
{
if (e.detail != 32)
return;
int index = listLogTypes.getSelectionIndex();
if (index < 0 || index >= logTypes.length)
{
return;
} else
{
TableItem item = (TableItem)e.item;
COConfigurationManager.setParameter((new StringBuilder()).append("bLog.").append(logTypes[index]).append(".").append(item.getData()).toString(), item.getChecked());
return;
}
}
{
this$0 = ConfigSectionLogging.this;
listLogTypes = list;
logTypes = ai;
super();
}
});
Control controls_main[] = {
cArea, gLogIDs
};
ChangeSelectionActionPerformer perf2 = new ChangeSelectionActionPerformer(controls_main);
enableLogging.setAdditionalActionPerformer(perf2);
enable_logger.setAdditionalActionPerformer(new IAdditionalActionPerformer() {
ChangeSelectionActionPerformer p1;
final BooleanParameter val$enableLogging;
final ConfigSectionLogging this$0;
public void performAction()
{
p1.performAction();
}
public void setSelected(boolean selected)
{
p1.setSelected(selected);
if (!selected && enableLogging.isSelected())
enableLogging.setSelected(false);
}
public void setIntValue(int j)
{
}
public void setStringValue(String s)
{
}
{
this$0 = ConfigSectionLogging.this;
enableLogging = booleanparameter;
super();
p1 = new ChangeSelectionActionPerformer(new Control[] {
enableLogging.getControl()
});
}
});
Label generate_net_info = new Label(gLogging, 0);
Messages.setLanguageText(generate_net_info, "ConfigView.section.logging.netinfo");
Button generate_net_button = new Button(gLogging, 8);
Messages.setLanguageText(generate_net_button, "ConfigView.section.logging.generatediagnostics");
generate_net_button.addListener(13, new Listener() {
final ConfigSectionLogging this$0;
public void handleEvent(Event event)
{
(new AEThread2("GenerateNetDiag", true) {
final 5 this$1;
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(ConfigSectionLogging.LOGID, (new StringBuilder()).append("Network Info:\n").append(info).toString()));
Utils.execSWTThread(new Runnable() {
final String val$info;
final 1 this$2;
public void run()
{
ClipboardCopy.copyToClipBoard(info);
}
{
this$2 = 1.this;
info = s;
super();
}
});
}
{
this$1 = 5.this;
super(x0, x1);
}
}).start();
}
{
this$0 = ConfigSectionLogging.this;
super();
}
});
Label generate_stats_info = new Label(gLogging, 0);
Messages.setLanguageText(generate_stats_info, "ConfigView.section.logging.statsinfo");
Button generate_stats_button = new Button(gLogging, 8);
Messages.setLanguageText(generate_stats_button, "ConfigView.section.logging.generatediagnostics");
generate_stats_button.addListener(13, new Listener() {
final ConfigSectionLogging this$0;
public void handleEvent(Event event)
{
Set types = new HashSet();
types.add(".*");
Map reply = AzureusCoreStats.getStats(types);
Iterator it = reply.entrySet().iterator();
StringBuffer buffer = new StringBuffer(16000);
java.util.Map.Entry entry;
for (; it.hasNext(); buffer.append((new StringBuilder()).append(entry.getKey()).append(" -> ").append(entry.getValue()).append("\r\n").toString()))
entry = (java.util.Map.Entry)it.next();
String str = buffer.toString();
ClipboardCopy.copyToClipBoard(str);
Logger.log(new LogEvent(ConfigSectionLogging.LOGID, (new StringBuilder()).append("Stats Info:\n").append(str).toString()));
}
{
this$0 = ConfigSectionLogging.this;
super();
}
});
Label generate_info = new Label(gLogging, 0);
Messages.setLanguageText(generate_info, "ConfigView.section.logging.generatediagnostics.info");
Button generate_button = new Button(gLogging, 8);
Messages.setLanguageText(generate_button, "ConfigView.section.logging.generatediagnostics");
generate_button.addListener(13, new Listener() {
final ConfigSectionLogging this$0;
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(ConfigSectionLogging.LOGID, (new StringBuilder()).append("Evidence Generation:\n").append(evidence).toString()));
}
{
this$0 = ConfigSectionLogging.this;
super();
}
});
return gLogging;
}
static
{
LOGID = LogIDs.GUI;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -