📄 configsectionplugins.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: ConfigSectionPlugins.java
package org.gudy.azureus2.ui.swt.views.configsections;
import com.aelitis.azureus.core.AzureusCore;
import com.aelitis.azureus.ui.swt.imageloader.ImageLoader;
import java.io.File;
import java.io.PrintStream;
import java.util.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
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.config.ParameterListener;
import org.gudy.azureus2.core3.internat.MessageText;
import org.gudy.azureus2.core3.util.*;
import org.gudy.azureus2.plugins.*;
import org.gudy.azureus2.plugins.ui.config.Parameter;
import org.gudy.azureus2.pluginsimpl.local.PluginInterfaceImpl;
import org.gudy.azureus2.pluginsimpl.local.ui.config.BooleanParameterImpl;
import org.gudy.azureus2.pluginsimpl.local.ui.config.ParameterRepository;
import org.gudy.azureus2.ui.swt.Messages;
import org.gudy.azureus2.ui.swt.Utils;
import org.gudy.azureus2.ui.swt.config.DualChangeSelectionActionPerformer;
import org.gudy.azureus2.ui.swt.config.plugins.PluginParameter;
import org.gudy.azureus2.ui.swt.mainwindow.Colors;
import org.gudy.azureus2.ui.swt.mainwindow.Cursors;
import org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection;
import org.gudy.azureus2.ui.swt.views.ConfigView;
public class ConfigSectionPlugins
implements UISWTConfigSection, ParameterListener
{
class FilterComparator
implements Comparator
{
boolean ascending;
static final int FIELD_LOAD = 0;
static final int FIELD_TYPE = 1;
static final int FIELD_NAME = 2;
static final int FIELD_VERSION = 3;
static final int FIELD_DIRECTORY = 4;
static final int FIELD_UNLOADABLE = 5;
int field;
String sUserPluginDir;
String sAppPluginDir;
final ConfigSectionPlugins this$0;
public int compare(Object arg0, Object arg1)
{
PluginInterface if0 = (PluginInterface)arg0;
PluginInterfaceImpl if1 = (PluginInterfaceImpl)arg1;
int result = 0;
switch (field)
{
case 0: // '\0'
{
boolean b0 = if0.getPluginState().isLoadedAtStartup();
boolean b1 = if1.getPluginState().isLoadedAtStartup();
result = b0 != b1 ? ((int) (b0 ? -1 : 1)) : 0;
if (result == 0)
result = if0.getPluginID().compareToIgnoreCase(if1.getPluginID());
break;
}
case 1: // '\001'
case 4: // '\004'
{
result = getFieldValue(field, if0).compareToIgnoreCase(getFieldValue(field, if1));
break;
}
case 3: // '\003'
{
String s0 = if0.getPluginVersion();
String s1 = if1.getPluginVersion();
if (s0 == null)
s0 = "";
if (s1 == null)
s1 = "";
result = s0.compareToIgnoreCase(s1);
break;
}
case 5: // '\005'
{
boolean b0 = if0.getPluginState().isUnloadable();
boolean b1 = if1.getPluginState().isUnloadable();
result = b0 != b1 ? ((int) (b0 ? -1 : 1)) : 0;
break;
}
}
if (result == 0)
result = if0.getPluginName().compareToIgnoreCase(if1.getPluginName());
if (!ascending)
result *= -1;
return result;
}
public boolean setField(int newField)
{
if (field == newField)
ascending = !ascending;
else
ascending = true;
field = newField;
return ascending;
}
public String getFieldValue(int iField, PluginInterface pluginIF)
{
switch (iField)
{
case 0: // '\0'
{
return pluginIF.getPluginID();
}
case 4: // '\004'
{
String sDirName = pluginIF.getPluginDirectoryName();
if (sDirName.length() > sUserPluginDir.length() && sDirName.substring(0, sUserPluginDir.length()).equals(sUserPluginDir))
return sDirName.substring(sUserPluginDir.length());
if (sDirName.length() > sAppPluginDir.length() && sDirName.substring(0, sAppPluginDir.length()).equals(sAppPluginDir))
return sDirName.substring(sAppPluginDir.length());
else
return sDirName;
}
case 2: // '\002'
{
return pluginIF.getPluginName();
}
case 1: // '\001'
{
String sDirName = pluginIF.getPluginDirectoryName();
String sKey;
if (sDirName.length() > sUserPluginDir.length() && sDirName.substring(0, sUserPluginDir.length()).equals(sUserPluginDir))
sKey = "perUser";
else
if (sDirName.length() > sAppPluginDir.length() && sDirName.substring(0, sAppPluginDir.length()).equals(sAppPluginDir))
sKey = "shared";
else
sKey = "builtIn";
return MessageText.getString((new StringBuilder()).append("ConfigView.pluginlist.column.type.").append(sKey).toString());
}
case 3: // '\003'
{
return pluginIF.getPluginVersion();
}
case 5: // '\005'
{
return MessageText.getString((new StringBuilder()).append("Button.").append(pluginIF.getPluginState().isUnloadable() ? "yes" : "no").toString()).replaceAll("&", "");
}
}
return "";
}
public FilterComparator()
{
String sep;
this$0 = ConfigSectionPlugins.this;
super();
ascending = true;
field = 2;
sep = System.getProperty("file.separator");
sUserPluginDir = FileUtil.getUserFile("plugins").toString();
if (sUserPluginDir.endsWith(sep)) goto _L2; else goto _L1
_L1:
new StringBuilder();
this;
JVM INSTR dup_x1 ;
sUserPluginDir;
append();
sep;
append();
toString();
sUserPluginDir;
_L2:
sAppPluginDir = FileUtil.getApplicationFile("plugins").toString();
if (sAppPluginDir.endsWith(sep)) goto _L4; else goto _L3
_L3:
new StringBuilder();
this;
JVM INSTR dup_x1 ;
sAppPluginDir;
append();
sep;
append();
toString();
sAppPluginDir;
_L4:
}
}
private static final String HEADER_PREFIX = "ConfigView.pluginlist.column.";
private static final String COLUMN_HEADERS[] = {
"loadAtStartup", "type", "name", "version", "directory", "unloadable"
};
private static final int COLUMN_SIZES[] = {
110, 50, 150, 75, 100, 50
};
private static final int COLUMN_ALIGNS[] = {
0x1000000, 16384, 16384, 0x20000, 16384, 0x1000000
};
private ConfigView configView;
private AzureusCore azureusCore;
FilterComparator comparator;
List pluginIFs;
private Table table;
private Image imgRedLed;
private Image imgGreenLed;
public ConfigSectionPlugins(ConfigView _configView, AzureusCore _azureusCore)
{
configView = _configView;
azureusCore = _azureusCore;
comparator = new FilterComparator();
}
public String configSectionGetParentSection()
{
return "root";
}
public String configSectionGetName()
{
return "plugins";
}
public void configSectionSave()
{
}
public int maxUserMode()
{
return 0;
}
public void configSectionDelete()
{
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.releaseImage("redled");
imageLoader.releaseImage("greenled");
}
public Composite configSectionCreate(Composite parent)
{
ImageLoader imageLoader = ImageLoader.getInstance();
imgRedLed = imageLoader.getImage("redled");
imgGreenLed = imageLoader.getImage("greenled");
Composite infoGroup = new Composite(parent, 0);
GridData gridData = new GridData(272);
infoGroup.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginWidth = 0;
layout.marginHeight = 0;
infoGroup.setLayout(layout);
infoGroup.setLayout(new GridLayout());
if (SWT.getVersion() < 3105)
infoGroup.addControlListener(new org.gudy.azureus2.ui.swt.Utils.LabelWrapControlListener());
String sep = System.getProperty("file.separator");
File fUserPluginDir = FileUtil.getUserFile("plugins");
String sUserPluginDir;
try
{
sUserPluginDir = fUserPluginDir.getCanonicalPath();
}
catch (Throwable e)
{
sUserPluginDir = fUserPluginDir.toString();
}
if (!sUserPluginDir.endsWith(sep))
sUserPluginDir = (new StringBuilder()).append(sUserPluginDir).append(sep).toString();
File fAppPluginDir = FileUtil.getApplicationFile("plugins");
String sAppPluginDir;
try
{
sAppPluginDir = fAppPluginDir.getCanonicalPath();
}
catch (Throwable e)
{
sAppPluginDir = fAppPluginDir.toString();
}
if (!sAppPluginDir.endsWith(sep))
sAppPluginDir = (new StringBuilder()).append(sAppPluginDir).append(sep).toString();
Label label = new Label(infoGroup, 64);
label.setLayoutData(new GridData(768));
Messages.setLanguageText(label, "ConfigView.pluginlist.whereToPut");
label = new Label(infoGroup, 64);
gridData = new GridData(768);
gridData.horizontalIndent = 10;
label.setLayoutData(gridData);
label.setText(sUserPluginDir.replaceAll("&", "&&"));
label.setForeground(Colors.blue);
label.setCursor(Cursors.handCursor);
final String _sUserPluginDir = sUserPluginDir;
label.addMouseListener(new MouseAdapter() {
final String val$_sUserPluginDir;
final ConfigSectionPlugins this$0;
public void mouseUp(MouseEvent arg0)
{
if (_sUserPluginDir.endsWith("/plugins/") || _sUserPluginDir.endsWith("\\plugins\\"))
{
File f = new File(_sUserPluginDir);
if (f.exists() && f.isDirectory())
{
Utils.launch(_sUserPluginDir);
} else
{
String azureusDir = _sUserPluginDir.substring(0, _sUserPluginDir.length() - 9);
System.out.println(azureusDir);
Utils.launch(azureusDir);
}
}
}
{
this$0 = ConfigSectionPlugins.this;
_sUserPluginDir = s;
super();
}
});
label = new Label(infoGroup, 64);
label.setLayoutData(new GridData(768));
Messages.setLanguageText(label, "ConfigView.pluginlist.whereToPutOr");
label = new Label(infoGroup, 64);
gridData = new GridData(768);
gridData.horizontalIndent = 10;
label.setLayoutData(gridData);
label.setText(sAppPluginDir.replaceAll("&", "&&"));
label.setForeground(Colors.blue);
label.setCursor(Cursors.handCursor);
final String _sAppPluginDir = sAppPluginDir;
label.addMouseListener(new MouseAdapter() {
final String val$_sAppPluginDir;
final ConfigSectionPlugins this$0;
public void mouseUp(MouseEvent arg0)
{
if (_sAppPluginDir.endsWith("/plugins/") || _sAppPluginDir.endsWith("\\plugins\\"))
{
File f = new File(_sAppPluginDir);
if (f.exists() && f.isDirectory())
{
Utils.launch(_sAppPluginDir);
} else
{
String azureusDir = _sAppPluginDir.substring(0, _sAppPluginDir.length() - 9);
System.out.println(azureusDir);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -