📄 configsectionplugins.java
字号:
Utils.launch(azureusDir);
}
}
}
{
this$0 = ConfigSectionPlugins.this;
_sAppPluginDir = s;
super();
}
});
pluginIFs = rebuildPluginIFs();
Collections.sort(pluginIFs, new Comparator() {
final ConfigSectionPlugins this$0;
public int compare(Object o1, Object o2)
{
return ((PluginInterface)o1).getPluginName().compareToIgnoreCase(((PluginInterface)o2).getPluginName());
}
{
this$0 = ConfigSectionPlugins.this;
super();
}
});
Label labelInfo = new Label(infoGroup, 64);
labelInfo.setLayoutData(new GridData(768));
Messages.setLanguageText(labelInfo, "ConfigView.pluginlist.info");
table = new Table(infoGroup, 0x10010824);
gridData = new GridData(1808);
gridData.heightHint = 200;
gridData.widthHint = 200;
table.setLayoutData(gridData);
for (int i = 0; i < COLUMN_HEADERS.length; i++)
{
final TableColumn tc = new TableColumn(table, COLUMN_ALIGNS[i]);
tc.setWidth(COLUMN_SIZES[i]);
tc.addSelectionListener(new SelectionAdapter() {
final TableColumn val$tc;
final ConfigSectionPlugins this$0;
public void widgetSelected(SelectionEvent e)
{
boolean ascending = comparator.setField(table.indexOf(tc));
try
{
table.setSortColumn(tc);
table.setSortDirection(ascending ? 128 : 1024);
}
catch (NoSuchMethodError ignore) { }
Collections.sort(pluginIFs, comparator);
table.clearAll();
}
{
this$0 = ConfigSectionPlugins.this;
tc = tablecolumn;
super();
}
});
Messages.setLanguageText(tc, (new StringBuilder()).append("ConfigView.pluginlist.column.").append(COLUMN_HEADERS[i]).toString());
}
table.setHeaderVisible(true);
Composite cButtons = new Composite(infoGroup, 0);
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 3;
cButtons.setLayout(layout);
cButtons.setLayoutData(new GridData());
final Button btnUnload = new Button(cButtons, 8);
btnUnload.setLayoutData(new GridData());
Messages.setLanguageText(btnUnload, "ConfigView.pluginlist.unloadSelected");
btnUnload.addSelectionListener(new SelectionAdapter() {
final ConfigSectionPlugins this$0;
public void widgetSelected(SelectionEvent e)
{
int items[] = table.getSelectionIndices();
for (int i = 0; i < items.length; i++)
{
int index = items[i];
if (index < 0 || index >= pluginIFs.size())
continue;
PluginInterface pluginIF = (PluginInterface)pluginIFs.get(index);
if (pluginIF.getPluginState().isOperational() && pluginIF.getPluginState().isUnloadable())
try
{
pluginIF.getPluginState().unload();
}
catch (PluginException e1)
{
e1.printStackTrace();
}
pluginIFs = rebuildPluginIFs();
table.setItemCount(pluginIFs.size());
Collections.sort(pluginIFs, comparator);
table.clearAll();
}
}
{
this$0 = ConfigSectionPlugins.this;
super();
}
});
btnUnload.setEnabled(false);
final Button btnLoad = new Button(cButtons, 8);
btnUnload.setLayoutData(new GridData());
Messages.setLanguageText(btnLoad, "ConfigView.pluginlist.loadSelected");
btnLoad.addSelectionListener(new SelectionAdapter() {
final ConfigSectionPlugins this$0;
public void widgetSelected(SelectionEvent e)
{
int items[] = table.getSelectionIndices();
for (int i = 0; i < items.length; i++)
{
int index = items[i];
if (index < 0 || index >= pluginIFs.size())
continue;
PluginInterface pluginIF = (PluginInterface)pluginIFs.get(index);
if (pluginIF.getPluginState().isOperational())
continue;
if (pluginIF.getPluginState().isDisabled())
{
if (pluginIF.getPluginState().hasFailed())
continue;
pluginIF.getPluginState().setDisabled(false);
}
try
{
pluginIF.getPluginState().reload();
}
catch (PluginException e1)
{
Debug.printStackTrace(e1);
}
pluginIFs = rebuildPluginIFs();
table.setItemCount(pluginIFs.size());
Collections.sort(pluginIFs, comparator);
table.clearAll();
}
}
{
this$0 = ConfigSectionPlugins.this;
super();
}
});
btnLoad.setEnabled(false);
Button btnScan = new Button(cButtons, 8);
btnScan.setLayoutData(new GridData());
Messages.setLanguageText(btnScan, "ConfigView.pluginlist.scan");
btnScan.addSelectionListener(new SelectionAdapter() {
final ConfigSectionPlugins this$0;
public void widgetSelected(SelectionEvent e)
{
azureusCore.getPluginManager().refreshPluginList(false);
pluginIFs = rebuildPluginIFs();
table.setItemCount(pluginIFs.size());
Collections.sort(pluginIFs, comparator);
table.clearAll();
}
{
this$0 = ConfigSectionPlugins.this;
super();
}
});
table.addListener(36, new Listener() {
final ConfigSectionPlugins this$0;
public void handleEvent(Event event)
{
TableItem item = (TableItem)event.item;
int index = table.indexOf(item);
PluginInterface pluginIF = (PluginInterface)pluginIFs.get(index);
for (int i = 0; i < ConfigSectionPlugins.COLUMN_HEADERS.length; i++)
{
if (i == 2)
item.setImage(i, pluginIF.getPluginState().isOperational() ? imgGreenLed : imgRedLed);
String sText = comparator.getFieldValue(i, pluginIF);
if (sText == null)
sText = "";
item.setText(i, sText);
}
item.setGrayed(pluginIF.getPluginState().isMandatory());
boolean bEnabled = pluginIF.getPluginState().isLoadedAtStartup();
Utils.setCheckedInSetData(item, bEnabled);
item.setData("PluginID", pluginIF.getPluginID());
Utils.alternateRowBackground(item);
}
{
this$0 = ConfigSectionPlugins.this;
super();
}
});
table.addSelectionListener(new SelectionAdapter() {
final Button val$btnUnload;
final Button val$btnLoad;
final ConfigSectionPlugins this$0;
public void widgetSelected(SelectionEvent e)
{
TableItem item = (TableItem)e.item;
int index = table.indexOf(item);
PluginInterface pluginIF = (PluginInterface)pluginIFs.get(index);
if (e.detail == 32)
{
if (item.getGrayed())
{
if (!item.getChecked())
item.setChecked(true);
return;
}
pluginIF.getPluginState().setDisabled(!item.getChecked());
pluginIF.getPluginState().setLoadedAtStartup(item.getChecked());
}
btnUnload.setEnabled(pluginIF.getPluginState().isOperational() && pluginIF.getPluginState().isUnloadable());
btnLoad.setEnabled(!pluginIF.getPluginState().isOperational() && !pluginIF.getPluginState().hasFailed());
}
{
this$0 = ConfigSectionPlugins.this;
btnUnload = button;
btnLoad = button1;
super();
}
});
table.setItemCount(pluginIFs.size());
return infoGroup;
}
private List rebuildPluginIFs()
{
List pluginIFs = Arrays.asList(azureusCore.getPluginManager().getPlugins());
PluginInterface pi;
for (Iterator iter = pluginIFs.iterator(); iter.hasNext(); COConfigurationManager.addParameterListener((new StringBuilder()).append("PluginInfo.").append(pi.getPluginID()).append(".enabled").toString(), this))
pi = (PluginInterface)iter.next();
return pluginIFs;
}
public void parameterChanged(String parameterName)
{
if (table != null)
Utils.execSWTThread(new AERunnable() {
final ConfigSectionPlugins this$0;
public void runSupport()
{
if (table != null && !table.isDisposed())
table.clearAll();
}
{
this$0 = ConfigSectionPlugins.this;
super();
}
});
}
public void initPluginSubSections()
{
org.eclipse.swt.widgets.TreeItem treePlugins = configView.findTreeItem("plugins");
ParameterRepository repository = ParameterRepository.getInstance();
String names[] = repository.getNames();
Arrays.sort(names);
for (int i = 0; i < names.length; i++)
{
String pluginName = names[i];
Parameter parameters[] = repository.getParameterBlock(pluginName);
boolean bUsePrefix = MessageText.keyExists((new StringBuilder()).append("ConfigView.section.plugins.").append(pluginName).toString());
Composite pluginGroup = configView.createConfigSection(treePlugins, pluginName, -2, bUsePrefix);
GridLayout pluginLayout = new GridLayout();
pluginLayout.numColumns = 3;
pluginGroup.setLayout(pluginLayout);
Map parameterToPluginParameter = new HashMap();
for (int j = 0; j < parameters.length; j++)
{
Parameter parameter = parameters[j];
parameterToPluginParameter.put(parameter, new PluginParameter(pluginGroup, parameter));
}
for (int j = 0; j < parameters.length; j++)
{
Parameter parameter = parameters[j];
if (!(parameter instanceof BooleanParameterImpl))
continue;
List parametersToEnable = ((BooleanParameterImpl)parameter).getEnabledOnSelectionParameters();
List controlsToEnable = new ArrayList();
for (Iterator iter = parametersToEnable.iterator(); iter.hasNext();)
{
Parameter parameterToEnable = (Parameter)iter.next();
PluginParameter pp = (PluginParameter)parameterToPluginParameter.get(parameterToEnable);
Control controls[] = pp.getControls();
int k = 0;
while (k < controls.length)
{
controlsToEnable.add(controls[k]);
k++;
}
}
List parametersToDisable = ((BooleanParameterImpl)parameter).getDisabledOnSelectionParameters();
List controlsToDisable = new ArrayList();
for (Iterator iter = parametersToDisable.iterator(); iter.hasNext();)
{
Parameter parameterToDisable = (Parameter)iter.next();
PluginParameter pp = (PluginParameter)parameterToPluginParameter.get(parameterToDisable);
Control controls[] = pp.getControls();
int k = 0;
while (k < controls.length)
{
controlsToDisable.add(controls[k]);
k++;
}
}
Control ce[] = new Control[controlsToEnable.size()];
Control cd[] = new Control[controlsToDisable.size()];
if (ce.length + cd.length > 0)
{
org.gudy.azureus2.ui.swt.config.IAdditionalActionPerformer ap = new DualChangeSelectionActionPerformer((Control[])(Control[])controlsToEnable.toArray(ce), (Control[])(Control[])controlsToDisable.toArray(cd));
PluginParameter pp = (PluginParameter)parameterToPluginParameter.get(parameter);
pp.setAdditionalActionPerfomer(ap);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -