sAppPluginDir += sep;
}
public int compare(Object arg0, Object arg1) {
PluginInterface if0 = (PluginInterface) arg0;
PluginInterfaceImpl if1 = (PluginInterfaceImpl) arg1;
int result = 0;
switch (field) {
case FIELD_LOAD: {
boolean b0 = if0.getPluginState().isLoadedAtStartup();
boolean b1 = if1.getPluginState().isLoadedAtStartup();
result = (b0 == b1 ? 0 : (b0 ? -1 : 1));
// Use the plugin ID name to sort by instead.
if (result == 0) {
result = if0.getPluginID().compareToIgnoreCase(
if1.getPluginID());
}
break;
}
case FIELD_TYPE:
case FIELD_DIRECTORY: {
result = getFieldValue(field, if0).compareToIgnoreCase(
getFieldValue(field, if1));
break;
}
case FIELD_VERSION: { // XXX Not really right..
String s0 = if0.getPluginVersion();
String s1 = if1.getPluginVersion();
if (s0 == null)
s0 = "";
if (s1 == null)
s1 = "";
result = s0.compareToIgnoreCase(s1);
break;
}
case FIELD_UNLOADABLE: {
boolean b0 = if0.getPluginState().isUnloadable();
boolean b1 = if1.getPluginState().isUnloadable();
result = (b0 == b1 ? 0 : (b0 ? -1 : 1));
break;
}
}
if (result == 0)
result = if0.getPluginName().compareToIgnoreCase(if1.getPluginName());
if (!ascending)
result *= -1;
return result;